icu-message-format-for-translators | Instructions for translators using the ICU Message Format | Internationalization library
kandi X-RAY | icu-message-format-for-translators Summary
kandi X-RAY | icu-message-format-for-translators Summary
Instructions for translators of format-message and other ICU Message Format based projects. The ICU Message Format is a great format for user-visible strings, and includes simple placeholders, number and date placeholders, and selecting among submessages for gender and plural arguments. The format is used in apis in C++, PHP, Java, and multiple JavaScript libraries. This repository is for a github page explaining the format for translators so that they can understand what parts get translated in a complex message. Any feedback or contributions are welcome.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of icu-message-format-for-translators
icu-message-format-for-translators Key Features
icu-message-format-for-translators Examples and Code Snippets
Community Discussions
Trending Discussions on icu-message-format-for-translators
QUESTION
I'm using react-intl and its tag.
I want to have a structured message that will pick the correct plural variant based on provided values to allow translators to work with rules of their language, i.e., if they have a different variant for "one", "two", "many", items, etc. I did not want to have it hardcoded inside of the application business logic via switch
statements that would use just English rules for "zero", "one", and "other".
should produce
I have some apples and some pears
from the following source.
For some reasons, it returns I have some apples, some pears, and some oranges
ANSWER
Answered 2020-Jan-14 at 12:34The issue is:
English as a language doesn't have grammar specialized specifically for zero number of items.
It is mainly singular or plural (on in some rare residual cases dual).
The syntax which you are using is specifically for those languages where grammar is specialized specifically for zero number of items. (Examples are Arabic and Latvian)
Read Here: https://formatjs.io/guides/message-syntax/#plural-format.
Also, this article on wikipedia explains the same
So, the approach won't work for English. Instead you need to use =0
(=value syntax) for matching quantity to zero for the solution to work.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install icu-message-format-for-translators
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page