Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added '+' prefix option to capitalize the words #3

Open
wants to merge 1 commit into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/Utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ const Gtk = imports.gi.Gtk;
/// @return {string} Datetime representation of format, or format if the conversion fails, or datetime representation of defaultFormat, or blank.
///
function dateTimeFormat(format, defaultFormat) {
return (format && new Date().toLocaleFormat(format) || format) || defaultFormat && new Date().toLocaleFormat(defaultFormat) || "";
var dtf = (format && new Date().toLocaleFormat(format) || format) || defaultFormat && new Date().toLocaleFormat(defaultFormat) || "";
// Capitalizes the words prefixed by + sign
dtf = dtf.replace(/(\+\b\w)/gi, function(m) {
return m.toUpperCase().replace("+", "");
});
return dtf;
}

///
Expand All @@ -23,4 +28,4 @@ function dateTimeFormat(format, defaultFormat) {
///
function getBuilder(gladeContent) {
return Gtk.Builder.new_from_string(gladeContent, gladeContent.length);
}
}
8 changes: 7 additions & 1 deletion src/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@
["1, 2, ...", "An optional decimal width specifier may follow the (possibly absent) flag. If the natural size of the field is smaller than this width, then the result string is padded (on the left) to the specified width."],
["E, O", "Some conversion specifications can be modified by preceding the conversion specifier character by the E or O modifier to indicate that an alternative format should be used. If the alternative format or specification does not exist for the current locale, the behavior will be as if the unmodified conversion specification were used.\nThe Single UNIX Specification mentions %Ec, %EC, %Ex, %EX, %Ey, %EY, %Od, %Oe, %OH, %OI, %Om, %OM, %OS, %Ou, %OU, %OV, %Ow, %OW, %Oy, where the effect of the O modifier is to use alternative numeric symbols (say, roman numerals), and that of the E modifier is to use a locale-dependent alternative representation."]
]
},
{
"label": "Other Options",
"content": [
["+", "Prefix the '%' character with a '+' sign to capitalize the next word."]
]
}
]
}
}