Skip to content

Commit

Permalink
Added complex ordering case from sprintf documentation of Perl, outpu…
Browse files Browse the repository at this point in the history
…t validation information added (should be some JS with green/red flag probably?), fixed update_locale.sh
  • Loading branch information
Getty committed Jan 5, 2013
1 parent eb1e163 commit 95efe61
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 4 deletions.
6 changes: 6 additions & 0 deletions t/20-locale-simple.t
Expand Up @@ -49,4 +49,10 @@ is(
"changing position test"
);

is(
l("Other change order test %s %s %s",1,2,3),
'Verhalten aus http://perldoc.perl.org/functions/sprintf.html 3 1 1',
"other changing position test"
);

done_testing;
2 changes: 1 addition & 1 deletion t/data/locale/de_DE/LC_MESSAGES/othertest.json
@@ -1 +1 @@
{"":{"Plural-Forms":" nplurals=2; plural=n != 1;","MIME-Version":" 1.0","POT-Creation-Date":" 2009-06-14 09:29-0400","Language":" de_DE","Last-Translator":" Community","Content-Type":" text/plain; charset=UTF-8","Language-Team":" DuckDuckGo Community <community@duckduckgo.com>","PO-Revision-Date":" 2009-06-14 09:29-0400","Content-Transfer-Encoding":" 8bit","Project-Id-Version":" DuckDuckGo-Translation-0.000"},"Other":[null,"Anderes"],"Umlaut-Test":[null,"Dies ist ein Ümläut"],"Hello":[null,"Anderes Hallo"],"Change order test %s %s":[null,"Ganz andere Reihenfolge hier %2$s %1$s"],"You have %d message":["You have %d messages","Du hast %d AndereNachricht","Du hast %d AndereNachrichten"]}
locale_data['othertest'] = {"":{"Plural-Forms":" nplurals=2; plural=n != 1;","MIME-Version":" 1.0","POT-Creation-Date":" 2009-06-14 09:29-0400","Language":" de_DE","Last-Translator":" Community","Content-Type":" text/plain; charset=UTF-8","Language-Team":" DuckDuckGo Community <community@duckduckgo.com>","PO-Revision-Date":" 2009-06-14 09:29-0400","Content-Transfer-Encoding":" 8bit","Project-Id-Version":" DuckDuckGo-Translation-0.000"},"Other":[null,"Anderes"],"Umlaut-Test":[null,"Dies ist ein Ümläut"],"Hello":[null,"Anderes Hallo"],"Change order test %s %s":[null,"Ganz andere Reihenfolge hier %2$s %1$s"],"You have %d message":["You have %d messages","Du hast %d AndereNachricht","Du hast %d AndereNachrichten"]};
2 changes: 1 addition & 1 deletion t/data/locale/de_DE/LC_MESSAGES/test.json
@@ -1 +1 @@
locale_data['test'] = {"":{"Plural-Forms":" nplurals=2; plural=n != 1;","MIME-Version":" 1.0","POT-Creation-Date":" 2009-06-14 09:29-0400","Language":" de_DE","Last-Translator":" Community","Content-Type":" text/plain; charset=UTF-8","Language-Team":" DuckDuckGo Community <community@duckduckgo.com>","PO-Revision-Date":" 2009-06-14 09:29-0400","Content-Transfer-Encoding":" 8bit","Project-Id-Version":" DuckDuckGo-Translation-0.000"},"Hello":[null,"Hallo"],"Change order test %s %s":[null,"Andere Reihenfolge hier %2$s %1$s"],"You have %d message of %s":["You have %d messages of %s","Du hast %d Nachricht von %s","Du hast %d Nachrichten von %s"],"You have %d message":["You have %d messages","Du hast %d Nachricht","Du hast %d Nachrichten"]};
locale_data['test'] = {"":{"Plural-Forms":" nplurals=2; plural=n != 1;","MIME-Version":" 1.0","POT-Creation-Date":" 2009-06-14 09:29-0400","Language":" de_DE","Last-Translator":" Community","Content-Type":" text/plain; charset=UTF-8","Language-Team":" DuckDuckGo Community <community@duckduckgo.com>","PO-Revision-Date":" 2009-06-14 09:29-0400","Content-Transfer-Encoding":" 8bit","Project-Id-Version":" DuckDuckGo-Translation-0.000"},"Hello":[null,"Hallo"],"Change order test %s %s":[null,"Andere Reihenfolge hier %2$s %1$s"],"You have %d message of %s":["You have %d messages of %s","Du hast %d Nachricht von %s","Du hast %d Nachrichten von %s"],"You have %d message":["You have %d messages","Du hast %d Nachricht","Du hast %d Nachrichten"],"Other change order test %s %s %s":[null,"Verhalten aus http://perldoc.perl.org/functions/sprintf.html %3$s %s %1$s"]};
Binary file modified t/data/locale/de_DE/LC_MESSAGES/test.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions t/data/locale/de_DE/LC_MESSAGES/test.po
Expand Up @@ -26,3 +26,6 @@ msgstr "Hallo"

msgid "Change order test %s %s"
msgstr "Andere Reihenfolge hier %2$s %1$s"

msgid "Other change order test %s %s %s"
msgstr "Verhalten aus http://perldoc.perl.org/functions/sprintf.html %3$s %s %1$s"
10 changes: 9 additions & 1 deletion t/data/locale_simple_test.html
Expand Up @@ -19,12 +19,20 @@
ltd('test');

add_t(l("Hello"));
add_t('Should be: "' + 'Hallo' + '"');
add_t(ln("You have %d message","You have %d messages",4));
add_t('Should be: "' + 'Du hast 4 Nachrichten' + '"');
add_t(ln("You have %d message","You have %d messages",1));
add_t('Should be: "' + 'Du hast 1 Nachricht' + '"');
add_t(ln("You have %d message of %s","You have %d messages of %s",4,'harry'));
add_t('Should be: "' + 'Du hast 4 Nachrichten von harry' + '"');
add_t(ln("You have %d message of %s","You have %d messages of %s",1,'harry'));
add_t('Should be: "' + 'Du hast 1 Nachricht von harry' + '"');
add_t(l("Change order test %s %s",1,2));

add_t('Should be: "' + 'Andere Reihenfolge hier 2 1' + '"');
add_t(l("Other change order test %s %s %s",1,2,3));
add_t('Should be: "' + 'Verhalten aus http://perldoc.perl.org/functions/sprintf.html 3 1 1' + '"');

}

</script>
Expand Down
2 changes: 1 addition & 1 deletion t/data/update_locale.sh
Expand Up @@ -6,6 +6,6 @@ for domain in test othertest
do
msgfmt -o $BASE/locale/de_DE/LC_MESSAGES/$domain.mo $BASE/locale/de_DE/LC_MESSAGES/$domain.po
echo -n "locale_data['$domain'] = " >$BASE/locale/de_DE/LC_MESSAGES/$domain.json
$BASE/../../share/js/gettext/po2json $BASE/locale/de_DE/LC_MESSAGES/$domain.po >>$BASE/locale/de_DE/LC_MESSAGES/$domain.json
$BASE/../../bin/po2json $BASE/locale/de_DE/LC_MESSAGES/$domain.po >>$BASE/locale/de_DE/LC_MESSAGES/$domain.json
echo ";" >>$BASE/locale/de_DE/LC_MESSAGES/$domain.json
done

0 comments on commit 95efe61

Please sign in to comment.