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.
const a = (n) => n == 1 ? 'one' : 'other';
const b = (n) => (n == 0 || n == 1) ? 'one' : 'other';
const c = (n) => n >= 0 && n <= 1 ? 'one' : 'other';
const d = (n) => {
const s = String(n).split('.'), v0 = !s[1];
return n == 1 && v0 ? 'one' : 'other';
};
const e = (n) => 'other';
const f = (n, c) => {
const s = String(n).split('.'), i = s[0], v0 = !s[1], i1000000 = i.slice(-6);
return n == 1 && v0 ? 'one'
: !c && i != 0 && i1000000 == 0 && v0 || c > 5 ? 'many'
: 'other';
};
const g = (n) => n == 1 ? 'one'
: n == 2 ? 'two'
: 'other';
export const af = a;
export const ak = b;
This file has been truncated. show original
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
loic
(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:
https://github.com/discourse/discourse/pull/28062
This should take care of most of the problems. Other patches should follow soon.
5 Likes
loic
(Loïc Guitaut)
July 26, 2024, 10:27am
6
Another patch has just been merged:
https://github.com/discourse/discourse/pull/28083
This will prevent creating invalid MF overrides in the admin UI.
5 Likes
loic
(Loïc Guitaut)
July 29, 2024, 1:46pm
7
Just merged this PR:
https://github.com/discourse/discourse/pull/28097
Pluralization rules in Ruby should now be up-to-date with the ones we have in JS
4 Likes
j.jaffeux
(Joffrey Jaffeux)
Closed
August 3, 2024, 1:46pm
8
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.