View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004205 | Taler | wallet (WebExtension) | public | 2016-02-24 17:33 | 2016-10-11 17:28 |
Reporter | Florian Dold | Assigned To | tg | ||
Priority | normal | Severity | feature | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Product Version | 0.0 | ||||
Target Version | 0.1 | Fixed in Version | 0.1 | ||
Summary | 0004205: add i18n.pluralize function | ||||
Description | Right now pluralization is only handled in .po files, but not at the source level. There should be a i18n.pluralize function that is detected by the pogen.ts extractor. It should be used like this: i18n.pluralize( `Hello ${name}, you have ${n} apple`, `Hello ${name}, you have ${n} apples`, 1) where the first argument is the singular form, the second argument is the plural form, and the third, optional argument is the position of the number that selects the plural/singular form in the format string. The number of placeholders must be the same in both forms. If the 3rd argument is omitted, the first numeric placeholder will be used for pluralization. | ||||
Tags | No tags attached. | ||||
|
Implemented the pluralize function the following way: let i = 1, n = 5; i18n.pluralize( i18n`#${i}: you have ${i18n.number(n)} apple.`, `#${i}: you have ${i18n.number(n)} apples.`); The extraction still needs to be done in pogen.js |
|
So the exact syntax recognized for extraction should be i18n.pluralize(i18n[.SUFFIX]`STRING1`, i18n.[.SUFFIX]`STRING2`) The extraction must make sure that the suffix for i18n is the same, and the number of template holes in STRING1 and STRING2 is the same. |
|
for the second argument i18n is not necessary, (it is only used for extraction and thus no processing is needed on it) |
|
Yes it is necessary. When there's no i18n resource for English, we need both strings from the source. Since sometimes the tag does not return a string (but for example a list of chunks, with i18n.parts), we need to have the tag in both strings for it to work. |
|
Tag parsing is implemented now. The JavaScript runtime part for selecting the singular/plural is still missing, tg should work on that. |
|
i18.plural() is implemented now as well |
Date Modified | Username | Field | Change |
---|---|---|---|
2016-02-24 17:33 | Florian Dold | New Issue | |
2016-02-24 17:33 | Florian Dold | Status | new => assigned |
2016-02-24 17:33 | Florian Dold | Assigned To | => Florian Dold |
2016-02-25 01:29 | tg | Note Added: 0010187 | |
2016-02-25 01:32 | tg | Note Edited: 0010187 | |
2016-02-25 01:32 | tg | Note Edited: 0010187 | |
2016-02-25 01:32 | tg | Note Edited: 0010187 | |
2016-02-25 01:33 | tg | Note Edited: 0010187 | |
2016-02-25 02:40 | tg | Note Edited: 0010187 | |
2016-02-25 20:46 | Christian Grothoff | Severity | minor => feature |
2016-02-25 20:46 | Christian Grothoff | Product Version | => 0.0 |
2016-02-25 20:46 | Christian Grothoff | Target Version | => 0.1 |
2016-03-02 02:26 | Florian Dold | Note Added: 0010210 | |
2016-03-02 14:55 | tg | Note Added: 0010217 | |
2016-03-02 14:58 | Florian Dold | Note Added: 0010218 | |
2016-03-20 21:53 | Torsten Grothoff | Issue cloned: 0004271 | |
2016-05-31 09:59 | Christian Grothoff | Assigned To | Florian Dold => tg |
2016-09-26 22:59 | Florian Dold | Note Added: 0011181 | |
2016-09-27 13:11 | tg | Note Added: 0011184 | |
2016-09-27 13:11 | tg | Status | assigned => resolved |
2016-09-27 13:11 | tg | Resolution | open => fixed |
2016-09-27 22:25 | Christian Grothoff | Fixed in Version | => 0.1 |
2016-10-11 17:28 | Christian Grothoff | Status | resolved => closed |
2023-04-13 20:37 | Florian Dold | Category | wallet (WebExtensions) => wallet (WebExtension) |