Moin
July 21, 2024, 3:39pm
1
Continuing the discussion from Issue with pluralized (count) translation override :
I think Hungarian is not the only language affected by this. After checking Hebrew because of this bug mentioning problems, I thought maybe even more languages are affected, so I started looking for more cases.
After finding another one, I expect that even more languages are affected.
2 Likes
david
(David Taylor)
July 22, 2024, 12:10pm
3
Thanks @Moin !
I’ve made this change to stop the bleeding. This will limit the impact of failed compilations so that they only affect _MF
strings, rather than taking down the whole site.
We’ll keep digging into the root cause, and update here when we have a solution.
11 Likes
flink91
(Loïc Guitaut)
July 25, 2024, 12:32pm
5
We’ve just merged a patch that relaxes the MessageFormat compiler, allowing invalid plural keys in the messages:
discourse:main
← discourse:loic-handle-bad-mf-pluralization-rules
opened 04:08PM - 24 Jul 24 UTC
We can get translations with invalid plural keys from Crowdin or from custom ove… rrides. Currently, this will raise an error and the locales won’t be outputted at all.
This PR addresses this issue by using the new `strict: false` option of our `messageformat-wrapper` gem, allowing to generate locales even if there are invalid plural keys present.
This should take care of most of the problems. Other patches should follow soon.
5 Likes
flink91
(Loïc Guitaut)
July 26, 2024, 10:27am
6
Another patch has just been merged:
discourse:main
← discourse:loic-validate-translation-overrides
opened 03:00PM - 25 Jul 24 UTC
Currently, when adding translation overrides, values aren’t validated for MF str… ings. This results in being able to add invalid plural keys or even strings containing invalid syntax.
This PR addresses this issue by compiling the string when saving an override if the key is detected as an MF one.
If there’s an error from the compiler, it’s added to the model errors, which in turn is displayed to the user in the admin UI, helping them to understand what went wrong.
----
![image](https://github.com/user-attachments/assets/7315f643-b764-411b-b962-92dac0cd0b20)
![image](https://github.com/user-attachments/assets/bb22c536-5bda-4f5f-8be6-6171b4427245)
This will prevent creating invalid MF overrides in the admin UI.
5 Likes
flink91
(Loïc Guitaut)
July 29, 2024, 1:46pm
7
Just merged this PR:
discourse:main
← discourse:loic-update-ruby-i18n-pluralization-rules
opened 03:56PM - 26 Jul 24 UTC
The current pluralization rules used by the I18n system in Ruby are obsolete and… don’t follow the official rules available at https://www.unicode.org/cldr/charts/45/supplemental/language_plural_rules.html.
Using https://github.com/ruby-i18n/ruby-cldr, new and updated ones have been generated.
Pluralization rules in Ruby should now be up-to-date with the ones we have in JS
4 Likes
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.