From b55108e57e27bf4ed7d2585655ff421f810645f8 Mon Sep 17 00:00:00 2001 From: Lode Claassen Date: Sun, 17 Feb 2019 12:31:20 +0100 Subject: [PATCH 1/3] show the clock in quarters with natural language --- Makefile | 2 +- README.md | 1 + format.js | 14 ++++++++++ locale/clock-override.pot | 34 +++++++++++++++++++++---- locale/de/LC_MESSAGES/clock-override.po | 33 ++++++++++++++++++++---- locale/es/LC_MESSAGES/clock-override.po | 34 +++++++++++++++++++++---- locale/fr/LC_MESSAGES/clock-override.po | 34 +++++++++++++++++++++---- locale/nb/LC_MESSAGES/clock-override.po | 34 +++++++++++++++++++++---- locale/pt/LC_MESSAGES/clock-override.po | 34 +++++++++++++++++++++---- prefs.js | 1 + 10 files changed, 190 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index 1ddf921..d99065e 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ all: build .PHONY: build build: locale/clock-override.pot $(distfiles) -locale/clock-override.pot: prefs.js +locale/clock-override.pot: format.js prefs.js xgettext --from-code=UTF-8 -k_ -kN_ -o $@ $? %.mo: %.po diff --git a/README.md b/README.md index e4275a9..3bb5d09 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ For techies, we use the [`GLib GDateTime` codes](https://developer.gnome.org/gli * `%;cf`, a little emoji Unicode clock face (thanks to [dsboger](https://github.com/stuartlangridge/gnome-shell-clock-override/commit/5941974a39d3dfa4f7adb227bdbe3bc50118bbc9) for that!) * `%;vf`, quarters as vulgar fractions + * `%;nf`, quarters in natural language * `%;@`, internet time (.beat) Note that we still try to honour Gnome Shell's clock settings. So if you expect your clock to show seconds (or to update once a second, rather than once a minute) then you'll need to have turned on "show seconds" in Gnome Tweak Tool (under Top Bar) (or [the terminal way](https://askubuntu.com/questions/39412/how-to-show-seconds-on-the-clock-in-gnome-3)). diff --git a/format.js b/format.js index 81f1b19..d2579d0 100644 --- a/format.js +++ b/format.js @@ -45,6 +45,20 @@ function format(FORMAT, now) { var vulgar_fraction = ["\u2070/\u2080", "\u00B9/\u2084", "\u00B9/\u2082", "\u00B3/\u2084", "\u00B9/\u2081"][quarters]; desired = desired.replace(/%;vf/g, vulgar_fraction); } + if (FORMAT.indexOf("%;nf") > -1) { + var hour = now.get_hour(); + var quarters = Math.round(now.get_minute() / 15); + + var natural_language = [ + _("%H o'clock"), + _("quarter past %H"), + _("half past %H"), + _("quarter to %;nH"), + _("%;nH o'clock") + ][quarters]; + natural_language = natural_language.replace(/%;nH/, hour + 1); + desired = desired.replace(/%;nf/g, natural_language); + } if (FORMAT.indexOf("%;cf") > -1) { var hour = now.get_hour(); // convert from 0-23 to 1-12 diff --git a/locale/clock-override.pot b/locale/clock-override.pot index 62d6759..2eb2cec 100644 --- a/locale/clock-override.pot +++ b/locale/clock-override.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-15 18:48+0200\n" +"POT-Creation-Date: 2019-02-17 12:14+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,6 +17,26 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" +#: format.js:53 +msgid "%H o'clock" +msgstr "" + +#: format.js:54 +msgid "quarter past %H" +msgstr "" + +#: format.js:55 +msgid "half past %H" +msgstr "" + +#: format.js:56 +msgid "quarter to %;nH" +msgstr "" + +#: format.js:57 +msgid "%;nH o'clock" +msgstr "" + #: prefs.js:51 msgid "Text to display instead of the clock" msgstr "" @@ -46,22 +66,26 @@ msgid "Slow time (quarters as fractions)" msgstr "" #: prefs.js:83 -msgid "ISO date and time (2014-01-30T14:50:10)" +msgid "Slow time (quarters in natural language)" msgstr "" #: prefs.js:84 -msgid "Local and Internet time" +msgid "ISO date and time (2014-01-30T14:50:10)" msgstr "" #: prefs.js:85 +msgid "Local and Internet time" +msgstr "" + +#: prefs.js:86 msgid "Something sillier" msgstr "" -#: prefs.js:85 +#: prefs.js:86 msgid "It is %M minutes past hour %H" msgstr "" -#: prefs.js:120 +#: prefs.js:121 #, javascript-format msgid "What do all these %x codes mean?" msgstr "" diff --git a/locale/de/LC_MESSAGES/clock-override.po b/locale/de/LC_MESSAGES/clock-override.po index 184b04e..cfcbd27 100644 --- a/locale/de/LC_MESSAGES/clock-override.po +++ b/locale/de/LC_MESSAGES/clock-override.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: GNOME Shell Extension Clock Override\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-05-20 18:26+0200\n" +"POT-Creation-Date: 2019-02-17 12:14+0100\n" "PO-Revision-Date: 2018-08-15 18:36+0200\n" "Last-Translator: Jonatan Hatakeyama Zeidler \n" "Language-Team: Jonatan H. Zeidler, Matthäus Brandl\n" @@ -19,6 +19,25 @@ msgstr "" "X-Poedit-SourceCharset: UTF-8\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +#: format.js:53 +msgid "%H o'clock" +msgstr "" + +#: format.js:54 +msgid "quarter past %H" +msgstr "" + +#: format.js:55 +msgid "half past %H" +msgstr "" + +#: format.js:56 +msgid "quarter to %;nH" +msgstr "" + +#: format.js:57 +msgid "%;nH o'clock" +msgstr "" #: prefs.js:51 msgid "Text to display instead of the clock" @@ -49,23 +68,27 @@ msgid "Slow time (quarters as fractions)" msgstr "Slow-Zeit (Viertelstunden als Brüche)" #: prefs.js:83 +msgid "Slow time (quarters in natural language)" +msgstr "" + +#: prefs.js:84 msgid "ISO date and time (2014-01-30T14:50:10)" msgstr "Datum und Zeit nach ISO (2014-01-30T14:50:10)" -#: prefs.js:84 +#: prefs.js:85 msgid "Local and Internet time" msgstr "Ortszeit und Internetzeit" -#: prefs.js:85 # In this context silly seems to convey a notion of funny instead of stupid. Hence "albern" instead of "dumm". +#: prefs.js:86 msgid "Something sillier" msgstr "Etwas Alberneres" -#: prefs.js:85 +#: prefs.js:86 msgid "It is %M minutes past hour %H" msgstr "Es ist %M Minuten nach %H Uhr" -#: prefs.js:120 +#: prefs.js:121 #, javascript-format msgid "What do all these %x codes mean?" msgstr "Was bedeuten all diese Codes mit %x?" diff --git a/locale/es/LC_MESSAGES/clock-override.po b/locale/es/LC_MESSAGES/clock-override.po index 11280c1..c5bc808 100644 --- a/locale/es/LC_MESSAGES/clock-override.po +++ b/locale/es/LC_MESSAGES/clock-override.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: GNOME Shell Extension Clock Override\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-15 18:48+0200\n" +"POT-Creation-Date: 2019-02-17 12:14+0100\n" "PO-Revision-Date: 2018-08-04 11:10+0200\n" "Last-Translator: Luis Zurro \n" "Language-Team: Luis Zurro\n" @@ -18,6 +18,26 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "\n" +#: format.js:53 +msgid "%H o'clock" +msgstr "" + +#: format.js:54 +msgid "quarter past %H" +msgstr "" + +#: format.js:55 +msgid "half past %H" +msgstr "" + +#: format.js:56 +msgid "quarter to %;nH" +msgstr "" + +#: format.js:57 +msgid "%;nH o'clock" +msgstr "" + #: prefs.js:51 msgid "Text to display instead of the clock" msgstr "Texto a mostrar en lugar del reloj" @@ -47,22 +67,26 @@ msgid "Slow time (quarters as fractions)" msgstr "Tiempo lento (cuartos como fracciones)" #: prefs.js:83 +msgid "Slow time (quarters in natural language)" +msgstr "" + +#: prefs.js:84 msgid "ISO date and time (2014-01-30T14:50:10)" msgstr "Fecha y hora ISO (2014-01-30T04:27:00)" -#: prefs.js:84 +#: prefs.js:85 msgid "Local and Internet time" msgstr "Tiempo local y de Internet" -#: prefs.js:85 +#: prefs.js:86 msgid "Something sillier" msgstr "Algo ridículo" -#: prefs.js:85 +#: prefs.js:86 msgid "It is %M minutes past hour %H" msgstr "Son las %H y %M minutos" -#: prefs.js:120 +#: prefs.js:121 #, javascript-format msgid "What do all these %x codes mean?" msgstr "¿Qué significan todos los códigos %x?" diff --git a/locale/fr/LC_MESSAGES/clock-override.po b/locale/fr/LC_MESSAGES/clock-override.po index c954452..10d0f43 100644 --- a/locale/fr/LC_MESSAGES/clock-override.po +++ b/locale/fr/LC_MESSAGES/clock-override.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: GNOME Shell Extension Clock Override\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-15 18:48+0200\n" +"POT-Creation-Date: 2019-02-17 12:14+0100\n" "PO-Revision-Date: 2019-01-27 18:12+0200\n" "Last-Translator: Kariiboo \n" "Language-Team: Kariiboo\n" @@ -17,6 +17,26 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: format.js:53 +msgid "%H o'clock" +msgstr "" + +#: format.js:54 +msgid "quarter past %H" +msgstr "" + +#: format.js:55 +msgid "half past %H" +msgstr "" + +#: format.js:56 +msgid "quarter to %;nH" +msgstr "" + +#: format.js:57 +msgid "%;nH o'clock" +msgstr "" + #: prefs.js:51 msgid "Text to display instead of the clock" msgstr "Texte à afficher à la place de l'horloge" @@ -46,22 +66,26 @@ msgid "Slow time (quarters as fractions)" msgstr "Heure approximative (par quart d'heure)" #: prefs.js:83 +msgid "Slow time (quarters in natural language)" +msgstr "" + +#: prefs.js:84 msgid "ISO date and time (2014-01-30T14:50:10)" msgstr "Date et heure au format ISO (2014-01-30T14:50:10)" -#: prefs.js:84 +#: prefs.js:85 msgid "Local and Internet time" msgstr "Heure locale et Internet" -#: prefs.js:85 +#: prefs.js:86 msgid "Something sillier" msgstr "Quelque chose de plus stupide" -#: prefs.js:85 +#: prefs.js:86 msgid "It is %M minutes past hour %H" msgstr "Il est %H et %M minutes" -#: prefs.js:120 +#: prefs.js:121 #, javascript-format msgid "What do all these %x codes mean?" msgstr "Que signifient ces codes %x ?" diff --git a/locale/nb/LC_MESSAGES/clock-override.po b/locale/nb/LC_MESSAGES/clock-override.po index f9c0f31..f1f462d 100644 --- a/locale/nb/LC_MESSAGES/clock-override.po +++ b/locale/nb/LC_MESSAGES/clock-override.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: GNOME Shell Extension Clock Override\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-07 21:42+0200\n" +"POT-Creation-Date: 2019-02-17 12:14+0100\n" "PO-Revision-Date: 2018-08-06 15:09+0200\n" "Last-Translator: Daniel Aleksandersen \n" "Language-Team: Daniel Aleksandersen\n" @@ -18,6 +18,26 @@ msgstr "" "X-Generator: Poedit 2.0.1\n" "X-Poedit-SourceCharset: UTF-8\n" +#: format.js:53 +msgid "%H o'clock" +msgstr "" + +#: format.js:54 +msgid "quarter past %H" +msgstr "" + +#: format.js:55 +msgid "half past %H" +msgstr "" + +#: format.js:56 +msgid "quarter to %;nH" +msgstr "" + +#: format.js:57 +msgid "%;nH o'clock" +msgstr "" + #: prefs.js:51 msgid "Text to display instead of the clock" msgstr "Tekst å vise istedenfor klokken" @@ -47,22 +67,26 @@ msgid "Slow time (quarters as fractions)" msgstr "Treg tid (kvarater som brøk)" #: prefs.js:83 +msgid "Slow time (quarters in natural language)" +msgstr "" + +#: prefs.js:84 msgid "ISO date and time (2014-01-30T14:50:10)" msgstr "ISO dato- og tidsformat (2014-01-30T14:50:10)" -#: prefs.js:84 +#: prefs.js:85 msgid "Local and Internet time" msgstr "Lokal og internettid" -#: prefs.js:85 +#: prefs.js:86 msgid "Something sillier" msgstr "Noe litt snålere" -#: prefs.js:85 +#: prefs.js:86 msgid "It is %M minutes past hour %H" msgstr "Klokken er %M minutter over %H" -#: prefs.js:120 +#: prefs.js:121 #, javascript-format msgid "What do all these %x codes mean?" msgstr "Hva betyr disse %x-kodene?" diff --git a/locale/pt/LC_MESSAGES/clock-override.po b/locale/pt/LC_MESSAGES/clock-override.po index f56b35f..0797277 100644 --- a/locale/pt/LC_MESSAGES/clock-override.po +++ b/locale/pt/LC_MESSAGES/clock-override.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: GNOME Shell Extension Clock Override\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-15 18:48+0200\n" +"POT-Creation-Date: 2019-02-17 12:14+0100\n" "PO-Revision-Date: 2018-10-29 04:00+0000\n" "Last-Translator: Isabelle Porto\n" "Language-Team: Isabelle Porto\n" @@ -17,6 +17,26 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: format.js:53 +msgid "%H o'clock" +msgstr "" + +#: format.js:54 +msgid "quarter past %H" +msgstr "" + +#: format.js:55 +msgid "half past %H" +msgstr "" + +#: format.js:56 +msgid "quarter to %;nH" +msgstr "" + +#: format.js:57 +msgid "%;nH o'clock" +msgstr "" + #: prefs.js:51 msgid "Text to display instead of the clock" msgstr "Texto a ser mostrado no lugar do relógio" @@ -46,22 +66,26 @@ msgid "Slow time (quarters as fractions)" msgstr "Tempo lento (quartos como frações)" #: prefs.js:83 +msgid "Slow time (quarters in natural language)" +msgstr "" + +#: prefs.js:84 msgid "ISO date and time (2014-01-30T14:50:10)" msgstr "Data e hora no formato ISO (2014-01-30T14:50:10)" -#: prefs.js:84 +#: prefs.js:85 msgid "Local and Internet time" msgstr "Horário local e da Internet" -#: prefs.js:85 +#: prefs.js:86 msgid "Something sillier" msgstr "Algo mais bobo" -#: prefs.js:85 +#: prefs.js:86 msgid "It is %M minutes past hour %H" msgstr "São %M minutos depois das %H" -#: prefs.js:120 +#: prefs.js:121 #, javascript-format msgid "What do all these %x codes mean?" msgstr "O que todos esses códigos %x significam?" diff --git a/prefs.js b/prefs.js index ea22dc2..7cd475f 100644 --- a/prefs.js +++ b/prefs.js @@ -80,6 +80,7 @@ const ClockOverrideSettings = new GObject.Class({ [_("A bell"), "🔔"], [_("An emoji clock face"), "%;cf"], [_("Slow time (quarters as fractions)"), "%H %;vf"], + [_("Slow time (quarters in natural language)"), "%;nf"], [_("ISO date and time (2014-01-30T14:50:10)"), "%FT%T"], [_("Local and Internet time"), "%H:%M @%;@."], [_("Something sillier"), _("It is %M minutes past hour %H")] From 7bbed978d78274a6793cfc6b00c8970fb2c2da1b Mon Sep 17 00:00:00 2001 From: Lode Claassen Date: Sun, 17 Feb 2019 12:46:23 +0100 Subject: [PATCH 2/3] also make the hour number in natural language --- format.js | 35 ++++++++++--- locale/clock-override.pot | 68 +++++++++++++++++++++---- locale/de/LC_MESSAGES/clock-override.po | 68 +++++++++++++++++++++---- locale/es/LC_MESSAGES/clock-override.po | 68 +++++++++++++++++++++---- locale/fr/LC_MESSAGES/clock-override.po | 68 +++++++++++++++++++++---- locale/nb/LC_MESSAGES/clock-override.po | 68 +++++++++++++++++++++---- locale/pt/LC_MESSAGES/clock-override.po | 68 +++++++++++++++++++++---- 7 files changed, 377 insertions(+), 66 deletions(-) diff --git a/format.js b/format.js index d2579d0..2651a51 100644 --- a/format.js +++ b/format.js @@ -48,15 +48,38 @@ function format(FORMAT, now) { if (FORMAT.indexOf("%;nf") > -1) { var hour = now.get_hour(); var quarters = Math.round(now.get_minute() / 15); + // convert from 0-23 to 1-12 + var next_hour = hour + 1; + if (next_hour > 12) { + next_hour -= 12; + } + if (next_hour == 0) { + next_hour = 12; + } + var natural_hours = [ + _("one"), + _("two"), + _("three"), + _("four"), + _("five"), + _("six"), + _("seven"), + _("eight"), + _("nine"), + _("ten"), + _("eleven"), + _("twelve") + ]; var natural_language = [ - _("%H o'clock"), - _("quarter past %H"), - _("half past %H"), - _("quarter to %;nH"), - _("%;nH o'clock") + _("%;naturalI o'clock"), + _("quarter past %;naturalI"), + _("half past %;naturalI"), + _("quarter to %;nextNaturalI"), + _("%;nextNaturalI o'clock") ][quarters]; - natural_language = natural_language.replace(/%;nH/, hour + 1); + natural_language = natural_language.replace(/%;naturalI/, natural_hours[hour-1]); + natural_language = natural_language.replace(/%;nextNaturalI/, natural_hours[next_hour-1]); desired = desired.replace(/%;nf/g, natural_language); } if (FORMAT.indexOf("%;cf") > -1) { diff --git a/locale/clock-override.pot b/locale/clock-override.pot index 2eb2cec..1295180 100644 --- a/locale/clock-override.pot +++ b/locale/clock-override.pot @@ -17,24 +17,72 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: format.js:53 -msgid "%H o'clock" +#: format.js:61 +msgid "one" msgstr "" -#: format.js:54 -msgid "quarter past %H" +#: format.js:62 +msgid "two" msgstr "" -#: format.js:55 -msgid "half past %H" +#: format.js:63 +msgid "three" msgstr "" -#: format.js:56 -msgid "quarter to %;nH" +#: format.js:64 +msgid "four" msgstr "" -#: format.js:57 -msgid "%;nH o'clock" +#: format.js:65 +msgid "five" +msgstr "" + +#: format.js:66 +msgid "six" +msgstr "" + +#: format.js:67 +msgid "seven" +msgstr "" + +#: format.js:68 +msgid "eight" +msgstr "" + +#: format.js:69 +msgid "nine" +msgstr "" + +#: format.js:70 +msgid "ten" +msgstr "" + +#: format.js:71 +msgid "eleven" +msgstr "" + +#: format.js:72 +msgid "twelve" +msgstr "" + +#: format.js:75 +msgid "%;naturalI o'clock" +msgstr "" + +#: format.js:76 +msgid "quarter past %;naturalI" +msgstr "" + +#: format.js:77 +msgid "half past %;naturalI" +msgstr "" + +#: format.js:78 +msgid "quarter to %;nextNaturalI" +msgstr "" + +#: format.js:79 +msgid "%;nextNaturalI o'clock" msgstr "" #: prefs.js:51 diff --git a/locale/de/LC_MESSAGES/clock-override.po b/locale/de/LC_MESSAGES/clock-override.po index cfcbd27..050817c 100644 --- a/locale/de/LC_MESSAGES/clock-override.po +++ b/locale/de/LC_MESSAGES/clock-override.po @@ -19,24 +19,72 @@ msgstr "" "X-Poedit-SourceCharset: UTF-8\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: format.js:53 -msgid "%H o'clock" +#: format.js:61 +msgid "one" msgstr "" -#: format.js:54 -msgid "quarter past %H" +#: format.js:62 +msgid "two" msgstr "" -#: format.js:55 -msgid "half past %H" +#: format.js:63 +msgid "three" msgstr "" -#: format.js:56 -msgid "quarter to %;nH" +#: format.js:64 +msgid "four" msgstr "" -#: format.js:57 -msgid "%;nH o'clock" +#: format.js:65 +msgid "five" +msgstr "" + +#: format.js:66 +msgid "six" +msgstr "" + +#: format.js:67 +msgid "seven" +msgstr "" + +#: format.js:68 +msgid "eight" +msgstr "" + +#: format.js:69 +msgid "nine" +msgstr "" + +#: format.js:70 +msgid "ten" +msgstr "" + +#: format.js:71 +msgid "eleven" +msgstr "" + +#: format.js:72 +msgid "twelve" +msgstr "" + +#: format.js:75 +msgid "%;naturalI o'clock" +msgstr "" + +#: format.js:76 +msgid "quarter past %;naturalI" +msgstr "" + +#: format.js:77 +msgid "half past %;naturalI" +msgstr "" + +#: format.js:78 +msgid "quarter to %;nextNaturalI" +msgstr "" + +#: format.js:79 +msgid "%;nextNaturalI o'clock" msgstr "" #: prefs.js:51 diff --git a/locale/es/LC_MESSAGES/clock-override.po b/locale/es/LC_MESSAGES/clock-override.po index c5bc808..d92ed53 100644 --- a/locale/es/LC_MESSAGES/clock-override.po +++ b/locale/es/LC_MESSAGES/clock-override.po @@ -18,24 +18,72 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "\n" -#: format.js:53 -msgid "%H o'clock" +#: format.js:61 +msgid "one" msgstr "" -#: format.js:54 -msgid "quarter past %H" +#: format.js:62 +msgid "two" msgstr "" -#: format.js:55 -msgid "half past %H" +#: format.js:63 +msgid "three" msgstr "" -#: format.js:56 -msgid "quarter to %;nH" +#: format.js:64 +msgid "four" msgstr "" -#: format.js:57 -msgid "%;nH o'clock" +#: format.js:65 +msgid "five" +msgstr "" + +#: format.js:66 +msgid "six" +msgstr "" + +#: format.js:67 +msgid "seven" +msgstr "" + +#: format.js:68 +msgid "eight" +msgstr "" + +#: format.js:69 +msgid "nine" +msgstr "" + +#: format.js:70 +msgid "ten" +msgstr "" + +#: format.js:71 +msgid "eleven" +msgstr "" + +#: format.js:72 +msgid "twelve" +msgstr "" + +#: format.js:75 +msgid "%;naturalI o'clock" +msgstr "" + +#: format.js:76 +msgid "quarter past %;naturalI" +msgstr "" + +#: format.js:77 +msgid "half past %;naturalI" +msgstr "" + +#: format.js:78 +msgid "quarter to %;nextNaturalI" +msgstr "" + +#: format.js:79 +msgid "%;nextNaturalI o'clock" msgstr "" #: prefs.js:51 diff --git a/locale/fr/LC_MESSAGES/clock-override.po b/locale/fr/LC_MESSAGES/clock-override.po index 10d0f43..47dac3f 100644 --- a/locale/fr/LC_MESSAGES/clock-override.po +++ b/locale/fr/LC_MESSAGES/clock-override.po @@ -17,24 +17,72 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: format.js:53 -msgid "%H o'clock" +#: format.js:61 +msgid "one" msgstr "" -#: format.js:54 -msgid "quarter past %H" +#: format.js:62 +msgid "two" msgstr "" -#: format.js:55 -msgid "half past %H" +#: format.js:63 +msgid "three" msgstr "" -#: format.js:56 -msgid "quarter to %;nH" +#: format.js:64 +msgid "four" msgstr "" -#: format.js:57 -msgid "%;nH o'clock" +#: format.js:65 +msgid "five" +msgstr "" + +#: format.js:66 +msgid "six" +msgstr "" + +#: format.js:67 +msgid "seven" +msgstr "" + +#: format.js:68 +msgid "eight" +msgstr "" + +#: format.js:69 +msgid "nine" +msgstr "" + +#: format.js:70 +msgid "ten" +msgstr "" + +#: format.js:71 +msgid "eleven" +msgstr "" + +#: format.js:72 +msgid "twelve" +msgstr "" + +#: format.js:75 +msgid "%;naturalI o'clock" +msgstr "" + +#: format.js:76 +msgid "quarter past %;naturalI" +msgstr "" + +#: format.js:77 +msgid "half past %;naturalI" +msgstr "" + +#: format.js:78 +msgid "quarter to %;nextNaturalI" +msgstr "" + +#: format.js:79 +msgid "%;nextNaturalI o'clock" msgstr "" #: prefs.js:51 diff --git a/locale/nb/LC_MESSAGES/clock-override.po b/locale/nb/LC_MESSAGES/clock-override.po index f1f462d..408171b 100644 --- a/locale/nb/LC_MESSAGES/clock-override.po +++ b/locale/nb/LC_MESSAGES/clock-override.po @@ -18,24 +18,72 @@ msgstr "" "X-Generator: Poedit 2.0.1\n" "X-Poedit-SourceCharset: UTF-8\n" -#: format.js:53 -msgid "%H o'clock" +#: format.js:61 +msgid "one" msgstr "" -#: format.js:54 -msgid "quarter past %H" +#: format.js:62 +msgid "two" msgstr "" -#: format.js:55 -msgid "half past %H" +#: format.js:63 +msgid "three" msgstr "" -#: format.js:56 -msgid "quarter to %;nH" +#: format.js:64 +msgid "four" msgstr "" -#: format.js:57 -msgid "%;nH o'clock" +#: format.js:65 +msgid "five" +msgstr "" + +#: format.js:66 +msgid "six" +msgstr "" + +#: format.js:67 +msgid "seven" +msgstr "" + +#: format.js:68 +msgid "eight" +msgstr "" + +#: format.js:69 +msgid "nine" +msgstr "" + +#: format.js:70 +msgid "ten" +msgstr "" + +#: format.js:71 +msgid "eleven" +msgstr "" + +#: format.js:72 +msgid "twelve" +msgstr "" + +#: format.js:75 +msgid "%;naturalI o'clock" +msgstr "" + +#: format.js:76 +msgid "quarter past %;naturalI" +msgstr "" + +#: format.js:77 +msgid "half past %;naturalI" +msgstr "" + +#: format.js:78 +msgid "quarter to %;nextNaturalI" +msgstr "" + +#: format.js:79 +msgid "%;nextNaturalI o'clock" msgstr "" #: prefs.js:51 diff --git a/locale/pt/LC_MESSAGES/clock-override.po b/locale/pt/LC_MESSAGES/clock-override.po index 0797277..9e5d43f 100644 --- a/locale/pt/LC_MESSAGES/clock-override.po +++ b/locale/pt/LC_MESSAGES/clock-override.po @@ -17,24 +17,72 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: format.js:53 -msgid "%H o'clock" +#: format.js:61 +msgid "one" msgstr "" -#: format.js:54 -msgid "quarter past %H" +#: format.js:62 +msgid "two" msgstr "" -#: format.js:55 -msgid "half past %H" +#: format.js:63 +msgid "three" msgstr "" -#: format.js:56 -msgid "quarter to %;nH" +#: format.js:64 +msgid "four" msgstr "" -#: format.js:57 -msgid "%;nH o'clock" +#: format.js:65 +msgid "five" +msgstr "" + +#: format.js:66 +msgid "six" +msgstr "" + +#: format.js:67 +msgid "seven" +msgstr "" + +#: format.js:68 +msgid "eight" +msgstr "" + +#: format.js:69 +msgid "nine" +msgstr "" + +#: format.js:70 +msgid "ten" +msgstr "" + +#: format.js:71 +msgid "eleven" +msgstr "" + +#: format.js:72 +msgid "twelve" +msgstr "" + +#: format.js:75 +msgid "%;naturalI o'clock" +msgstr "" + +#: format.js:76 +msgid "quarter past %;naturalI" +msgstr "" + +#: format.js:77 +msgid "half past %;naturalI" +msgstr "" + +#: format.js:78 +msgid "quarter to %;nextNaturalI" +msgstr "" + +#: format.js:79 +msgid "%;nextNaturalI o'clock" msgstr "" #: prefs.js:51 From 9f6cf5228821bb05a61d92ff7efb4f0acfd84349 Mon Sep 17 00:00:00 2001 From: Lode Claassen Date: Sun, 17 Feb 2019 13:16:17 +0100 Subject: [PATCH 3/3] fix 12 hour clock for current hour --- format.js | 12 ++++++++- locale/clock-override.pot | 36 ++++++++++++------------- locale/de/LC_MESSAGES/clock-override.po | 36 ++++++++++++------------- locale/es/LC_MESSAGES/clock-override.po | 36 ++++++++++++------------- locale/fr/LC_MESSAGES/clock-override.po | 36 ++++++++++++------------- locale/nb/LC_MESSAGES/clock-override.po | 36 ++++++++++++------------- locale/pt/LC_MESSAGES/clock-override.po | 36 ++++++++++++------------- 7 files changed, 119 insertions(+), 109 deletions(-) diff --git a/format.js b/format.js index 2651a51..72bf797 100644 --- a/format.js +++ b/format.js @@ -46,8 +46,18 @@ function format(FORMAT, now) { desired = desired.replace(/%;vf/g, vulgar_fraction); } if (FORMAT.indexOf("%;nf") > -1) { - var hour = now.get_hour(); var quarters = Math.round(now.get_minute() / 15); + + var hour = now.get_hour(); + + // convert from 0-23 to 1-12 + if (hour > 12) { + hour -= 12; + } + if (hour == 0) { + hour = 12; + } + // convert from 0-23 to 1-12 var next_hour = hour + 1; if (next_hour > 12) { diff --git a/locale/clock-override.pot b/locale/clock-override.pot index 1295180..045a530 100644 --- a/locale/clock-override.pot +++ b/locale/clock-override.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-02-17 12:14+0100\n" +"POT-Creation-Date: 2019-02-17 13:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,71 +17,71 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: format.js:61 +#: format.js:71 msgid "one" msgstr "" -#: format.js:62 +#: format.js:72 msgid "two" msgstr "" -#: format.js:63 +#: format.js:73 msgid "three" msgstr "" -#: format.js:64 +#: format.js:74 msgid "four" msgstr "" -#: format.js:65 +#: format.js:75 msgid "five" msgstr "" -#: format.js:66 +#: format.js:76 msgid "six" msgstr "" -#: format.js:67 +#: format.js:77 msgid "seven" msgstr "" -#: format.js:68 +#: format.js:78 msgid "eight" msgstr "" -#: format.js:69 +#: format.js:79 msgid "nine" msgstr "" -#: format.js:70 +#: format.js:80 msgid "ten" msgstr "" -#: format.js:71 +#: format.js:81 msgid "eleven" msgstr "" -#: format.js:72 +#: format.js:82 msgid "twelve" msgstr "" -#: format.js:75 +#: format.js:85 msgid "%;naturalI o'clock" msgstr "" -#: format.js:76 +#: format.js:86 msgid "quarter past %;naturalI" msgstr "" -#: format.js:77 +#: format.js:87 msgid "half past %;naturalI" msgstr "" -#: format.js:78 +#: format.js:88 msgid "quarter to %;nextNaturalI" msgstr "" -#: format.js:79 +#: format.js:89 msgid "%;nextNaturalI o'clock" msgstr "" diff --git a/locale/de/LC_MESSAGES/clock-override.po b/locale/de/LC_MESSAGES/clock-override.po index 050817c..066eaba 100644 --- a/locale/de/LC_MESSAGES/clock-override.po +++ b/locale/de/LC_MESSAGES/clock-override.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: GNOME Shell Extension Clock Override\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-02-17 12:14+0100\n" +"POT-Creation-Date: 2019-02-17 13:13+0100\n" "PO-Revision-Date: 2018-08-15 18:36+0200\n" "Last-Translator: Jonatan Hatakeyama Zeidler \n" "Language-Team: Jonatan H. Zeidler, Matthäus Brandl\n" @@ -19,71 +19,71 @@ msgstr "" "X-Poedit-SourceCharset: UTF-8\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: format.js:61 +#: format.js:71 msgid "one" msgstr "" -#: format.js:62 +#: format.js:72 msgid "two" msgstr "" -#: format.js:63 +#: format.js:73 msgid "three" msgstr "" -#: format.js:64 +#: format.js:74 msgid "four" msgstr "" -#: format.js:65 +#: format.js:75 msgid "five" msgstr "" -#: format.js:66 +#: format.js:76 msgid "six" msgstr "" -#: format.js:67 +#: format.js:77 msgid "seven" msgstr "" -#: format.js:68 +#: format.js:78 msgid "eight" msgstr "" -#: format.js:69 +#: format.js:79 msgid "nine" msgstr "" -#: format.js:70 +#: format.js:80 msgid "ten" msgstr "" -#: format.js:71 +#: format.js:81 msgid "eleven" msgstr "" -#: format.js:72 +#: format.js:82 msgid "twelve" msgstr "" -#: format.js:75 +#: format.js:85 msgid "%;naturalI o'clock" msgstr "" -#: format.js:76 +#: format.js:86 msgid "quarter past %;naturalI" msgstr "" -#: format.js:77 +#: format.js:87 msgid "half past %;naturalI" msgstr "" -#: format.js:78 +#: format.js:88 msgid "quarter to %;nextNaturalI" msgstr "" -#: format.js:79 +#: format.js:89 msgid "%;nextNaturalI o'clock" msgstr "" diff --git a/locale/es/LC_MESSAGES/clock-override.po b/locale/es/LC_MESSAGES/clock-override.po index d92ed53..cde8871 100644 --- a/locale/es/LC_MESSAGES/clock-override.po +++ b/locale/es/LC_MESSAGES/clock-override.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: GNOME Shell Extension Clock Override\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-02-17 12:14+0100\n" +"POT-Creation-Date: 2019-02-17 13:13+0100\n" "PO-Revision-Date: 2018-08-04 11:10+0200\n" "Last-Translator: Luis Zurro \n" "Language-Team: Luis Zurro\n" @@ -18,71 +18,71 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "\n" -#: format.js:61 +#: format.js:71 msgid "one" msgstr "" -#: format.js:62 +#: format.js:72 msgid "two" msgstr "" -#: format.js:63 +#: format.js:73 msgid "three" msgstr "" -#: format.js:64 +#: format.js:74 msgid "four" msgstr "" -#: format.js:65 +#: format.js:75 msgid "five" msgstr "" -#: format.js:66 +#: format.js:76 msgid "six" msgstr "" -#: format.js:67 +#: format.js:77 msgid "seven" msgstr "" -#: format.js:68 +#: format.js:78 msgid "eight" msgstr "" -#: format.js:69 +#: format.js:79 msgid "nine" msgstr "" -#: format.js:70 +#: format.js:80 msgid "ten" msgstr "" -#: format.js:71 +#: format.js:81 msgid "eleven" msgstr "" -#: format.js:72 +#: format.js:82 msgid "twelve" msgstr "" -#: format.js:75 +#: format.js:85 msgid "%;naturalI o'clock" msgstr "" -#: format.js:76 +#: format.js:86 msgid "quarter past %;naturalI" msgstr "" -#: format.js:77 +#: format.js:87 msgid "half past %;naturalI" msgstr "" -#: format.js:78 +#: format.js:88 msgid "quarter to %;nextNaturalI" msgstr "" -#: format.js:79 +#: format.js:89 msgid "%;nextNaturalI o'clock" msgstr "" diff --git a/locale/fr/LC_MESSAGES/clock-override.po b/locale/fr/LC_MESSAGES/clock-override.po index 47dac3f..44f13bf 100644 --- a/locale/fr/LC_MESSAGES/clock-override.po +++ b/locale/fr/LC_MESSAGES/clock-override.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: GNOME Shell Extension Clock Override\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-02-17 12:14+0100\n" +"POT-Creation-Date: 2019-02-17 13:13+0100\n" "PO-Revision-Date: 2019-01-27 18:12+0200\n" "Last-Translator: Kariiboo \n" "Language-Team: Kariiboo\n" @@ -17,71 +17,71 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: format.js:61 +#: format.js:71 msgid "one" msgstr "" -#: format.js:62 +#: format.js:72 msgid "two" msgstr "" -#: format.js:63 +#: format.js:73 msgid "three" msgstr "" -#: format.js:64 +#: format.js:74 msgid "four" msgstr "" -#: format.js:65 +#: format.js:75 msgid "five" msgstr "" -#: format.js:66 +#: format.js:76 msgid "six" msgstr "" -#: format.js:67 +#: format.js:77 msgid "seven" msgstr "" -#: format.js:68 +#: format.js:78 msgid "eight" msgstr "" -#: format.js:69 +#: format.js:79 msgid "nine" msgstr "" -#: format.js:70 +#: format.js:80 msgid "ten" msgstr "" -#: format.js:71 +#: format.js:81 msgid "eleven" msgstr "" -#: format.js:72 +#: format.js:82 msgid "twelve" msgstr "" -#: format.js:75 +#: format.js:85 msgid "%;naturalI o'clock" msgstr "" -#: format.js:76 +#: format.js:86 msgid "quarter past %;naturalI" msgstr "" -#: format.js:77 +#: format.js:87 msgid "half past %;naturalI" msgstr "" -#: format.js:78 +#: format.js:88 msgid "quarter to %;nextNaturalI" msgstr "" -#: format.js:79 +#: format.js:89 msgid "%;nextNaturalI o'clock" msgstr "" diff --git a/locale/nb/LC_MESSAGES/clock-override.po b/locale/nb/LC_MESSAGES/clock-override.po index 408171b..f1923e8 100644 --- a/locale/nb/LC_MESSAGES/clock-override.po +++ b/locale/nb/LC_MESSAGES/clock-override.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: GNOME Shell Extension Clock Override\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-02-17 12:14+0100\n" +"POT-Creation-Date: 2019-02-17 13:13+0100\n" "PO-Revision-Date: 2018-08-06 15:09+0200\n" "Last-Translator: Daniel Aleksandersen \n" "Language-Team: Daniel Aleksandersen\n" @@ -18,71 +18,71 @@ msgstr "" "X-Generator: Poedit 2.0.1\n" "X-Poedit-SourceCharset: UTF-8\n" -#: format.js:61 +#: format.js:71 msgid "one" msgstr "" -#: format.js:62 +#: format.js:72 msgid "two" msgstr "" -#: format.js:63 +#: format.js:73 msgid "three" msgstr "" -#: format.js:64 +#: format.js:74 msgid "four" msgstr "" -#: format.js:65 +#: format.js:75 msgid "five" msgstr "" -#: format.js:66 +#: format.js:76 msgid "six" msgstr "" -#: format.js:67 +#: format.js:77 msgid "seven" msgstr "" -#: format.js:68 +#: format.js:78 msgid "eight" msgstr "" -#: format.js:69 +#: format.js:79 msgid "nine" msgstr "" -#: format.js:70 +#: format.js:80 msgid "ten" msgstr "" -#: format.js:71 +#: format.js:81 msgid "eleven" msgstr "" -#: format.js:72 +#: format.js:82 msgid "twelve" msgstr "" -#: format.js:75 +#: format.js:85 msgid "%;naturalI o'clock" msgstr "" -#: format.js:76 +#: format.js:86 msgid "quarter past %;naturalI" msgstr "" -#: format.js:77 +#: format.js:87 msgid "half past %;naturalI" msgstr "" -#: format.js:78 +#: format.js:88 msgid "quarter to %;nextNaturalI" msgstr "" -#: format.js:79 +#: format.js:89 msgid "%;nextNaturalI o'clock" msgstr "" diff --git a/locale/pt/LC_MESSAGES/clock-override.po b/locale/pt/LC_MESSAGES/clock-override.po index 9e5d43f..40f6294 100644 --- a/locale/pt/LC_MESSAGES/clock-override.po +++ b/locale/pt/LC_MESSAGES/clock-override.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: GNOME Shell Extension Clock Override\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-02-17 12:14+0100\n" +"POT-Creation-Date: 2019-02-17 13:13+0100\n" "PO-Revision-Date: 2018-10-29 04:00+0000\n" "Last-Translator: Isabelle Porto\n" "Language-Team: Isabelle Porto\n" @@ -17,71 +17,71 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: format.js:61 +#: format.js:71 msgid "one" msgstr "" -#: format.js:62 +#: format.js:72 msgid "two" msgstr "" -#: format.js:63 +#: format.js:73 msgid "three" msgstr "" -#: format.js:64 +#: format.js:74 msgid "four" msgstr "" -#: format.js:65 +#: format.js:75 msgid "five" msgstr "" -#: format.js:66 +#: format.js:76 msgid "six" msgstr "" -#: format.js:67 +#: format.js:77 msgid "seven" msgstr "" -#: format.js:68 +#: format.js:78 msgid "eight" msgstr "" -#: format.js:69 +#: format.js:79 msgid "nine" msgstr "" -#: format.js:70 +#: format.js:80 msgid "ten" msgstr "" -#: format.js:71 +#: format.js:81 msgid "eleven" msgstr "" -#: format.js:72 +#: format.js:82 msgid "twelve" msgstr "" -#: format.js:75 +#: format.js:85 msgid "%;naturalI o'clock" msgstr "" -#: format.js:76 +#: format.js:86 msgid "quarter past %;naturalI" msgstr "" -#: format.js:77 +#: format.js:87 msgid "half past %;naturalI" msgstr "" -#: format.js:78 +#: format.js:88 msgid "quarter to %;nextNaturalI" msgstr "" -#: format.js:79 +#: format.js:89 msgid "%;nextNaturalI o'clock" msgstr ""