-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extensionattributes #324
base: master
Are you sure you want to change the base?
Extensionattributes #324
Conversation
e.g.: [[[This %0 allows %1 to have %2|||regex|||nuggets|||(((recursive %0|||(((parameters///comment3)))///comment2)))///comment1]]] -> This regex allows nuggets to have recursive parameters
…de other nuggets): README, Unit test and bug fix.
With **conditionals** you can use a single nugget tag and have different translations according to the value of parameters. [[[%0_PRODUCTS_ADDED_TO_ORDER]]] -> "%0{0:No products were added|1:1 product was added|%0 products were added} to your order" [[[DEAR_SIR_OR_MADAM|||@ViewBag.Gender]]] -> "Dear %0{M:Sir|F:Madam|user}"
Conditionals allow you to create conditional translations depending on the argument itself, but sometimes the decision must not be made on something that you know in advance but rather on some language-specific attribute. Portuguese: [[[The %0 is being exported.]]] -> "%0_GENDER{M:O %0 está sendo exportado.|A %0 está sendo exportada.}" [[[map]]] -> "mapa" [[[map_GENDER]]] -> "M" [[[The %0 is being exported.|||(((map)))]]] -> "O mapa está sendo exportado" (masculine) French: [[[The %0 is being exported.]]] -> "%0_GENDER{M:Le %0 a été exporté.|F:La %0 a été exporté.}" [[[map]]] -> "carte" [[[map_GENDER]]] -> "F" [[[The %0 is being exported.|||(((map)))]]] -> "Le carte a été exporté" (feminine)
This contains the same commits as #323 - would it be easier to push it all as one pull request? Do these changes support plural forms or is it just a conditional statement? |
Yes, #324 supports number inflections (plural forms) and gender inflections by using conditional statements. Although #323 isolated may look simple and unnecessary, it's crucial for #324 to work (that's why #324 contains #323 commits). I submitted #323 individually because I think the purpose of conditionals (#323) is much easier to understand than the purpose of extension attributes (#324). BTW: #322 is completely unrelated. THAT shouldn't be part of this pull request. Sorry. |
So the way you handle plurals here is by using a conditional statement and not the way described here? How does this look in the generated pot files, does it generate an entry per conditional statement? |
Extension Attributes
Conditionals allow you to create conditional translations depending on the argument itself, but sometimes the decision must not be made on something that you know in advance but rather on some language-specific attribute.
For example, "map" in portuguese is masculine gender but in french it's feminine gender.
Portuguese:
French:
This is based on https://github.com/siefca/i18n-inflector