You are here: start » plugin_tutorial_i18n

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
plugin_tutorial_i18n [2013/04/18 20:21]
Christoph M. Becker added "Parametrization" section
plugin_tutorial_i18n [2018/10/26 15:33] (current)
Line 32: Line 32:
  
 <​code=php>​str_replace('​{{FILENAME}}',​ $FILENAME, 'The file {{FILENAME}} could not be saved!'​)</​code>​ <​code=php>​str_replace('​{{FILENAME}}',​ $FILENAME, 'The file {{FILENAME}} could not be saved!'​)</​code>​
 +
 +===== Plural =====
 +
 +Sometimes you need language strings for varying numbers, e.g. "3 files have been uploaded."​ When there was only one file uploaded it should read "1 file has been uploaded."​ You can use a workaround like "​Number of files uploaded: $x" or "$x file(s) has/have been uploaded",​ but both are somewhat clumsy.
 +
 +Recommended solution: use two language strings, one for the singular and another for the plural. But note, that there are languages with a third number, the paucal ((I'm not sure if the name is correct)), which is used in Czech and Slovak for example. This number is used for two to four occurrences. I'm not sure, if there are other languages which have even other numbers, but for CMSimple_XH the following convention seems to suffice: use actually three language strings. One for singular (1), another one for the paucal (2-4) and yet another one for plural (5+ and 0).
  
 << [[plugin_tutorial_intro|Introduction]] | [[plugin_tutorial_config|Configuration]] >> << [[plugin_tutorial_intro|Introduction]] | [[plugin_tutorial_config|Configuration]] >>
 
You are here: start » plugin_tutorial_i18n
Except where otherwise noted, content on this wiki is licensed under the following license: GNU Free Documentation License 1.3
Valid XHTML 1.0 Valid CSS Driven by DokuWiki