This is an automated email from the ASF dual-hosted git repository. diru pushed a commit to branch issue/SLING-10654 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-testing-content.git
commit dc071180bef7c6099f2de448a128d40f650805ea Author: Dirk Rudolph <[email protected]> AuthorDate: Fri Jul 23 13:17:18 2021 +0200 add test content for icu plural test Including: - some format expressions and data being used for the same - some translations of the pattern used in a non-trivial language --- src/main/resources/SLING-INF/apps/sightly/locales/cs.json | 10 ++++++++++ .../SLING-INF/apps/sightly/scripts/format/FormatPojo.java | 15 +++++++++++++++ .../SLING-INF/apps/sightly/scripts/format/format.html | 9 +++++++++ 3 files changed, 34 insertions(+) diff --git a/src/main/resources/SLING-INF/apps/sightly/locales/cs.json b/src/main/resources/SLING-INF/apps/sightly/locales/cs.json new file mode 100644 index 0000000..fb62664 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/locales/cs.json @@ -0,0 +1,10 @@ +{ + "jcr:primaryType": "nt:unstructured", + "jcr:mixinTypes": [ "mix:language" ], + "jcr:language": "cs", + "results-plural": { + "jcr:primaryType": "sling:MessageEntry", + "sling:key": "{0,plural,one{# result} other{# results}}", + "sling:message": "{0,plural,one{# výsledek} few{# výsledky} other{# výsledků}}" + } +} \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/format/FormatPojo.java b/src/main/resources/SLING-INF/apps/sightly/scripts/format/FormatPojo.java index 394d68b..8597538 100644 --- a/src/main/resources/SLING-INF/apps/sightly/scripts/format/FormatPojo.java +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/format/FormatPojo.java @@ -29,4 +29,19 @@ public class FormatPojo { return date; } + public int getZero() { + return 0; + } + + public int getOne() { + return 1; + } + + public int getFew() { + return 3; + } + + public int getMany() { + return 15; + } } \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/format/format.html b/src/main/resources/SLING-INF/apps/sightly/scripts/format/format.html index 790144a..18538f4 100644 --- a/src/main/resources/SLING-INF/apps/sightly/scripts/format/format.html +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/format/format.html @@ -19,4 +19,13 @@ <p id="format-date-2">${'short' @ format=pojo.date, timezone='UTC', locale='de_DE', type='date'}</p> <p id="format-date-3">${'short' @ format=pojo.date, timezone='UTC', locale='de_DE'}</p> <p id="format-date-4">${'FULL' @ format=pojo.date, timezone='UTC', locale='de_DE', type='date'}</p> + +<p id="format-icu-plural-zero">${'{0,plural,one{# result} other{# results}}' @ format=pojo.zero, locale='en', i18n }</p> +<p id="format-icu-plural-one">${'{0,plural,one{# result} other{# results}}' @ format=pojo.one, locale='en', i18n }</p> +<p id="format-icu-plural-few">${'{0,plural,one{# result} other{# results}}' @ format=pojo.few, locale='en', i18n }</p> +<p id="format-icu-plural-many">${'{0,plural,one{# result} other{# results}}' @ format=pojo.many, locale='en', i18n }</p> +<p id="format-icu-plural-zero-cs">${'{0,plural,one{# result} other{# results}}' @ format=pojo.zero, locale='cs', i18n }</p> +<p id="format-icu-plural-one-cs">${'{0,plural,one{# result} other{# results}}' @ format=pojo.one, locale='cs', i18n }</p> +<p id="format-icu-plural-few-cs">${'{0,plural,one{# result} other{# results}}' @ format=pojo.few, locale='cs', i18n }</p> +<p id="format-icu-plural-many-cs">${'{0,plural,one{# result} other{# results}}' @ format=pojo.many, locale='cs', i18n }</p> </div> \ No newline at end of file
