glpi
glpi copied to clipboard
Fix "Simcards" menu item on GLPI sidebar
Revert https://github.com/glpi-project/glpi/pull/16377/ because it breaks the Menu "Simcards" title on GLPI for other languages like Portuguese-Brazil (with PR #16377 instead of showing "Cartões SIM" it shows "Cartões SIM itens", which is wrong in my native language).
| Q | A |
|---|---|
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | #number |
The initial PR was aimed at distinguishing
Item_DeviceSimcardfromDeviceSimcard. If the problem only affects certain languages, it's probably a translation issue that needs to be corrected in Transiflex.
Hello @Rom1-B, It’s great to see the author of the original PR that breaks the translation. If it works for your environment, fine. But GLPI core should be changed to accomplish the change you proposed and further tests be made just because you wanted it to look beautiful in a drop-down of a third party plug-in. The word “itens” on the final of the menu item of your PR isn’t possible to reorder. Eg. the GLPI core translate Item_DeviceSimCard as two separate strings (“Simcard” and “item”). It’s exactly as it should look like on English. But in Portuguese it has another order (it should be “Itens” “de” “Cartão SIM”, where “de” connects the two words similar to “of” in English). Your change also breaks the books and documentation, as this menu is now referred as “Simcard items” and not as “Simcard” anymore, and the word now doesn’t fit the menu on Portuguese and maybe on other languages too. I’m not saying that your change is wrong by itself, but GLPI core should handle the translation of “Items_[]” menus on sidebar the same as “[]” translation to not break the published documentation, book and the translation worldwide.
I must admit I do not understand the problem... In the PR, Simcard is used. If you get SImcard items; then there is an issue in the translation.
As far as I understand, the PR you want to revert aims to fix the issue you describes.
I must admit I do not understand the problem... In the PR,
Simcardis used. If you getSImcard items; then there is an issue in the translation.As far as I understand, the PR you want to revert aims to fix the issue you describes.
In my PR shows “Simcard”, with the @Rom1-B PR shows “Simcard items”, which doesn’t exist on the translation and isn’t possible to translate because it’s the junction of two separate strings which can’t be reordered. This fix restore the behavior that already exists on GLPI which was broken by @Rom1-B PR.
and isn’t possible to translate because it’s the junction of two separate strings which can’t be reordered
On Transifex, the string "%s items" can be reordered by simply moving the "%s" part. Are there cases where "% items" is valid and other cases where it needs to be "items %s"?
and isn’t possible to translate because it’s the junction of two separate strings which can’t be reordered
On Transifex, the string "%s items" can be reordered by simply moving the "%s" part. Are there cases where "% items" is valid and other cases where it needs to be "items %s"?
There’s cases on Portuguese that we use “de” (masculine), “do” (masculine) or “da” (feminine) depending on word context. We can attempt to use “de”, which is more neutral even being masculine, but I’m not sure how it’s applicable on other languages.
Edit: Also, the string ''%s items'' has a different meaning on my language. In the context of Transifex, it's related to numbers of items (e.g. "2 items" related to the number of Crontasks executed, it's correctly written on my native language) and not "Itens de Simcard", so it can't be interchangeably used. If the @Rom1-B fix is right, I recommend creating a new string related to menu/asset items as this may affect other language translations too, or maybe creating a "%d items" related to Crontask items so the "%s items" could be correctly translated on my native language (Portuguese).
and isn’t possible to translate because it’s the junction of two separate strings which can’t be reordered
There’s cases on Portuguese that we use “de” (masculine), “do” (masculine) or “da” (feminine) depending on word context. We can attempt to use “de”, which is more neutral even being masculine, but I’m not sure how it’s applicable on other languages.
I don't know how other gendered languages have handled the localization in GLPI. I guess the neutral/default term should be used. Whatever your language allows when you don't know the gender of a word. I have no clue how that works since I only really know English.
Edit: Also, the string ''%s items'' has a different meaning on my language. In the context of Transifex, it's related to numbers of items (e.g. "2 items" related to the number of Crontasks executed, it's correctly written on my native language) and not "Itens de Simcard", so it can't be interchangeably used. If the @Rom1-B fix is right, I recommend creating a new string related to menu/asset items as this may affect other language translations too, or maybe creating a "%d items" related to Crontask items so the "%s items" could be correctly translated on my native language (Portuguese).
~There is in fact already a "%d item" and "%d items" string, but it isn't used everywhere that numbers are involved.~ I guess this would be an easy fix. For the menu name, it probably wouldn't be very easy/clean to do since there is a single localized name for the class. Also, the Simcard name was a bit of a hack that overrode the default "%s items" string. It was probably done when it was added to the assets menu, but when there was an option added to allow the other device types to be in the asset menu, a similar change wasn't made. I think the Devices need to be renamed as "%s models" and the Item_Devices need to be simply "Simcards", "Batteries", etc.
There is in fact already a "%d item" and "%d items" string, but it isn't used everywhere that numbers are involved. I guess this would be an easy fix.
I couldn't find those strings, at least on my native language (Portuguese-Brazil, pt-BR) on GLPI 10.X/11.X tree on Transiflex. It would be great if both "%d items" and "%s items" could coexist and be used on different contexts as it would allows those items to be corretly written on other languages.
I think the Devices need to be renamed as "%s models" and the Item_Devices need to be simply "Simcards", "Batteries", etc.
I agree with your suggestion and I believe it would keep the translation as is, without breaking it for other languages/users.
I couldn't find those strings, at least on my native language (Portuguese-Brazil, pt-BR) on GLPI 10.X/11.X tree on Transiflex.
Nevermind. I don't know what I was looking at, but they don't exist yet.
We should handle all Device / Item_Devices classes the same way, and we should probably use different strings for the device and the device items. If it is necessary to declare the full strings in the code (e.g.
_n('Simcard item', 'Simcard items', $nb)) to permit to have correct translations, then it must be done for all devices types, and must be done long enough before a release to give enough time to translators to handle these new strings.
I agree. There's any roadmap and a bracnh for this? So I could update this PR and target it to the right branch.
I think the Devices need to be renamed as "%s models" and the Item_Devices need to be simply "Simcards", "Batteries", etc.
Let's go with that, it seems to be the consensus.
There's any roadmap and a bracnh for this
After discussing the subject at the office with @cedric-anne, here is the proposed plan:
- Keep the current PR and update it with the above plan.
- A 10.0.18 is planned for soon, so it doesn't give us sufficient time to let people translate on Transifex.
- After 10.0.18 is released, we merge this pr, and it will be available publically in the next release (10.0.19) a few months later.
I think the Devices need to be renamed as "%s models" and the Item_Devices need to be simply "Simcards", "Batteries", etc.
Let's go with that, it seems to be the consensus.
I believe it's okay to don't have the string item after its name if we don't have any other place with names like "Batteries", "Simcards", etc.
Because even having the option to translate Battery item, Simcard item, and its order, wouldn't be anyway better to mention "Item de Cartão SIM" for example. That would be like write "Élement de Carte SIM" as it was an element of a SIMCard, not the simcard itself.
There's any roadmap and a bracnh for this
After discussing the subject at the office with @ cedric-anne, here is the proposed plan:
Keep the current PR and update it with the above plan. A 10.0.18 is planned for soon, so it doesn't give us sufficient time to let people translate on Transifex. After 10.0.18 is released, we merge this pr, and it will be available publically in the next release (10.0.19) a few months later.
I agree, since it's been there since when the items were placed at the assets' module.
I'll close this PR as I'm not sure what happened for it to have so much commits, I think it lost mine and there's so much changes to dig into that it simply doesn't worth it. From what I've seen from other comments on this PR, GLPI 11 will have another approach for menu items so this issue may not reflect there.