Skip to content
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

[v9rc3] Fresh manual install with French selected language error #9739

Closed
christophey2k opened this issue Aug 18, 2021 · 15 comments
Closed

[v9rc3] Fresh manual install with French selected language error #9739

christophey2k opened this issue Aug 18, 2021 · 15 comments

Comments

@christophey2k
Copy link

Zend \ I18n \ Exception \ RuntimeException
The language file /application/languages/fr_FR/LC_MESSAGES/messages.mo for French (France) has 2 plural forms instead of 3.

just after selecting French language in the installation menu.

@mlocati
Copy link
Contributor

mlocati commented Aug 18, 2021

That's an issue I'm aware of.

The problem is the following:

  1. Concrete uses gettext/languages to manage the language plural rules (for example, English has 2 plural forms, Japanese 1, Arabic 5)
  2. gettext/languages uses the Unicode CLDR data
  3. I've recently updated gettext/languages so that it now uses the latest version (39) of the CLDR data
  4. CLDR 39 changed the number of plural rules for French from 2 to 3
  5. The Concrete translation server uses an older version of gettext/languages, where the number of plurals is 2
  6. When Concrete 9 fetches French language files from the translation server, it expects that they have 3 plural cases, but only 2 are received.

I've been thinking for a solution for a while, but I still haven't found a satisfying one...

@mlocati
Copy link
Contributor

mlocati commented Aug 19, 2021

Ok, I think I found a solution.

Since #7204 got merged (that is, since concrete5 8.5.0), Concrete is able to load translation files with more plural cases than the expected ones (see here).

So, we can safely update the data provided by translate.concretecms.org for French.

Here's what I'd do on the translation server (obviously we'd need to take a backup first).

  1. Be sure that it uses the latest gettext/languages version (that is, ^2.8.1)
  2. Update the database with the following queries:
    START TRANSACTION
    ;
    UPDATE CommunityTranslationLocales SET
    	pluralForms = 'a:3:{i:0;s:8:"one:0, 1";i:1;s:47:"many:1000000, 1c6, 2c6, 3c6, 4c6, 5c6, 6c6, …";i:2;s:71:"other:2~17, 100, 1000, 10000, 100000, 1c3, 2c3, 3c3, 4c3, 5c3, 6c3, …";}',
    	pluralFormula = '(n == 0 || n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2)'
    WHERE
    	id = 'fr_FR'
    ;
    UPDATE CommunityTranslationTranslations SET
    	text2 = text1
    WHERE
    	locale = 'fr_FR'
    	AND text1 != ''
    	AND text2 = ''
    ;
    COMMIT
    ;

That way:

  • translate.concretecms.org will provide French translation files with 3 plural cases
  • concrete versions using 3 plural cases for French will be able to load them (because the number of plural cases is the expected one)
  • concrete versions using 2 plural cases for French will be able to load them (because fixPlurals will lower the plural cases from 3 to 2)
  • concrete versions using 3 plural cases for French will be able to load them (because the number of plural cases is the expected one)

@christophey2k
Copy link
Author

The package php-gettext is currently not available for Ubuntu 20.04

@mlocati
Copy link
Contributor

mlocati commented Aug 22, 2021

The package php-gettext is currently not available for Ubuntu 20.04

@christophey2k I'm referring to the gettext/languages package of packagist, not to an Ubuntu/Debian system package.

@nebuleu
Copy link

nebuleu commented Sep 17, 2021

I'm facing the same problem with v8.5.6, released today, after updating a site from 8.5.5.

@diederik-maes
Copy link

Hi, is there a solution for this already or should I roll back to V 8.5.5 ?
Website is working fine in NL and EN but not in FR

@mlocati
Copy link
Contributor

mlocati commented Oct 27, 2021

@diederik-maes You have to manually edit the file concrete/src/Localization/Translator/Loader/Gettext.php with these changes, or you have to wait until the next 8.5.x release

@diederik-maes
Copy link

@mlocati thanks for the fast reply.
Do I simply overwrite the whole content with the one you sent me or should I go look for just certain lines?

@diederik-maes
Copy link

I simply took the risk after a backup of the file and it seemed to have fixed the problem. Thanks again.

@mlocati
Copy link
Contributor

mlocati commented Oct 27, 2021

Do I simply overwrite the whole content with the one you sent me or should I go look for just certain lines?

Yep, you can overwrite the file

@haeflimi
Copy link
Contributor

haeflimi commented Nov 3, 2021

@mlocati @aembler
This seems to be a rather problematic Issue that also affects v8 sites that are updated to 8.5.6. - Basically breaking all sites that use the french language.
What makes things worse is that rolling back to 8.5.5 isn't that easy (at leaset using composer) because of the dependency Issue with the phpass Library.

So, if you already know how how to solve this: What speaks against pushing out a 8.5.6.1 respectively 9.0.1 release asap, that fixes that issue? - In case that's no option... when is the next 8.x release planned?

tbh: It's a bit frustrating that we have to create a fork/ fixed version for EVERY concreteCMS minor release, because there is some known but unresolved Issue that breaks things.

@mlocati
Copy link
Contributor

mlocati commented Nov 3, 2021

@haeflimi #9837 fixes the issue for v8

@haeflimi
Copy link
Contributor

haeflimi commented Nov 3, 2021

@mlocati
Yes, thank you for that!
I've already forked 8.5.6 to our own git& composer repositories, added your patch and rolled it out to a few affected client sites. - Looks like French is back on the menu. 👍
I still dislike that the core team doesn't seem to care enough to publish a new release that fixes that. - This will cause headaches to quite a few french speeking/ multilingual concreteCMS Users/Admins for no good reason.

@apaccou
Copy link
Contributor

apaccou commented Nov 3, 2021

I agree with @haeflimi. We are waiting for a fix on the core to upgrade our sites from 8.5.5. I hope it will be quick.

@mlocati
Copy link
Contributor

mlocati commented Dec 13, 2021

This should have been fixed by #9838

@aembler aembler closed this as completed Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants