Support Forum

Language Issue

TL tonya_lunarwp
tonya_lunarwp
Member

We are having trouble setting the language for the forum.  Our site is set to French in the WordPress Settings -> General and in config.php.  However, when we go to Forum -> Integration ->Language Translations it tells us this:

Your site language setting is English/US and therefore no translation files are required for Simple:Press

How do we set the forum to French?

 

A few notes:

  1. config.php has: define(‘WPLANG’, ‘fr_FR’);
  2. WordPress Settings -> General language is set to French (fr_FR)
  3. The sp-fr.po file is stored in wp-content/sp-resources/forum-language/simple-press/ (where forum admin -> WP Integration -> Storage Locations says it should go)
  4. The backend and frontend of the forum is shown in English
  5. And when we go to Forum -> Integration -> Language Translations we get the message listed above about being set to English/US for the site
  6. We are running a multisite

17 Answers

New Answer

TL tonya_lunarwp
tonya_lunarwp
Member

Hi Ike,

Yes, I read through the entire article.  I did add notes (see above)  to my original post to show all the settings.  Our site is set to fr_FR both in the settings and in config.php.  I downloaded and installed the sp-fr.po.  Yet, I’m getting the message:

Your site language setting is English/US and therefore no translation files are required for Simple:Press

 

Any ideas?  We want to go live with the forum, but we need it to be in French.  This is the last piece to launch today.

TL tonya_lunarwp
tonya_lunarwp
Member

I added both the .po and .mo files.  The only thing I see with the available translations is that they are sp-fr.po and there are no sp-fr_FR.po available, even though WordPress specifies French as fr_FR.  Will that affect it?

IK Ike
Ike
Member

OK..

For a start, you should only need the .mo files not the .po’s. These contain the translations in a format WordPress can read..

The language files should have the right name structure, so you’ll need the ‘sp-‘ at the front which you already have, but the rest has to match your WP language file. So your file name there should be ‘sp-fr_FR.mo’.

Also – when looking at the forum itself the majority of the text is generated from the theme, so you won’t notice a huge amount of change using only the core translations. So looking at the Projects page in glotpress you will also want to download translations for the theme, and any plugins you are using.

Hope this helps!

TL tonya_lunarwp
tonya_lunarwp
Member

I changed the sp-fr.mo to sp-fr_FR.mo as well as spa-fr.mo to spa-fr_FR.mo.  I still get the same message:

 

Your site language setting is English/US and therefore no translation files are required for Simple:Press.

 

Forum is v 5.5.1.

IK Ike
Ike
Member

Can you just check the WP translation file name? Should be in wp-content > languages.

TL tonya_lunarwp
tonya_lunarwp
Member

wp-content/languages

fr_FR.mo

admin-fr_FR.mo

admin-network-fr_FR.mo

contentients-cities-fr_FR.mo

plugins (folder)

themes (folder)

* plus all .po files are there too

YS Yellow Swordfish
Yellow Swordfish
Member

That’s very strange. Looking at the code the test that results in that message is explicitly looking for the language setting of the site to be ‘en_US’ or just ‘en’. It is hard to know what is going on there without being able to interrogate your database directly. But it does NOT look at downloaded language files – only the WP language setting in the database.

One of the worse things that the WordPress team ever did was to start a process that ended up using incorrect language codes. The official language code for French is simply ‘fr’. ‘fr_FR’ is a nonsense code made up by WordPress. The SP Translation site – interestingly also a WordPress owned system – actually uses the correct codes so all French project files (intended to be used in France itself) are simply ‘fr’ as they should be.

This is beyond our control and it means that the MO files generated by the website often need to have their filename adjusted to match the incorrect WordPress language codes.

The Language panel in the forum admin will try and change these to what the user needs them to be except in your case, of course, it thinks you are running in English. While I know there are one or two issues with the system in 5.5.3 (mainly to do with identifying some of our plugins), mistaking your site to be English is not one of them that we know of and not one we can replicare.

This does mean that a manual download from the translation site is probably the way to go until at least you can try the next SP update at the end of this month

As Ike said above – the bulk of the translations that you see on the forum screen will come from the theme MO file but thete is an easy way to determine of the core MO file is doing it;s job. SImply open the ‘About’ popup (from the link on the footer) and you should see the terms in there in your own language using the core SP language MO file.

TL tonya_lunarwp
tonya_lunarwp
Member

Looking in the options database table, WPLANG is set to fr_FR.  That was one of the first things I checked.

French version of WordPress actually is packaged with the translation files as fr_FR and not fr.  I just re-downloaded the latest version of WordPress core from the link I provided to confirm this.  I invite you take a look and you’ll see that “fr” is not used.

At this point then, I’ll look in the simplepress code and make the adjustment.  Hopefully though this can be resolved in the next version released.

Thanks,

Tonya

YS Yellow Swordfish
Yellow Swordfish
Member

I am not sure what you are getting at here.

i know that WordPress uses ‘fr_FR’ for French as I said above. It is incorrect but I know they use it.

As to changing something in the SP code then there is nothing to change and I do not have a clue what it is you are proposing to change. Things work just fine for most people.

The only question mark I have here is why it is determining that you are running in English. Have you checked if there s a WP_LANG constant in the wp-config.php file set to English? WordPress made the transition from the constant to the database option record in V4.0. Depending on your SP version it might be looking there. Any checks with that constant were removed in SP version 5.5.3.

TL tonya_lunarwp
tonya_lunarwp
Member

Hello,

Let me walk through what I found and did:

  1. Yes, WPLANG in the _options db is set to ‘fr_FR’.
  2. And I had the define in the config.php just in case the code was still using it

Debug effort:

1) After a global search for the message ‘Your site language setting is English/US and therefore no translation files are required for Simple:Press’, I found it in the file simple-press/admin/forms/panel-integration/spa-integration-language-form.php. After var_dump on $locale and $siteLang, the initial states are ‘fr_FR’, but then after the substr on $siteLang it is false. Therefore, I forced $siteLang to ‘fr’ when $locale is ‘fr_FR’,  see the code change (Gist).

This change got rid of the message and allowed me to then load up each of the translation files through the admin panel.

2) Quick check on the frontend and it still was not loading the French translations.

3) Next I searched for where $locale and/or get_locale() where being used.

See file simple-press/sp-startup/site/sp-site-support-functions.php line 184 in function sp_localisation().  A quick var_dump on $locale shows it is set to ‘fr_FR’.  As all the translation files are set to -fr.mo and not -fr_FR.mo, I added the conditional to set $locale = ‘fr’.  See the changes here in this gist.  I made similar changes in sp_plugin_localisation() and sp_theme_localisation().

Now French loads.

 

I hope this debug effort and code examples help.

Cheers,

Tonya

YS Yellow Swordfish
Yellow Swordfish
Member

Let’s start at 1 please…

What ‘substr’ are you referring to. There is no substr() being used as far as I can see.

What version of Simple:Press is this? And what version of WordPress?

TL tonya_lunarwp
tonya_lunarwp
Member

Simple:Press version 5.5.1

WordPress version 4.1