Jump to content

Your current server locale setting does not work …


kaz
 Share

Recommended Posts

At admin login the following message is displayed:

Hinweis: Ihre aktuelle Server-Locale-Einstellung funktioniert nicht wie erwartet mit dem UTF-8-Zeichensatz und kann kleinere Probleme verursachen. Ihre aktuelle Gebietsschema-Einstellung ist "en_US.UTF-8". Bitte übersetzen Sie die "C"-Locale-Einstellung für jede Sprache in die kompatible Locale in /wire/modules/LanguageSupport/LanguageSupport.module:
Default
Beispielsweise könnte die Gebietsschema-Einstellung für US-Englisch lauten: en_US.UTF-8

Note: Your current server locale setting does not work as expected with the UTF-8 character set and may cause minor problems. Your current locale setting is "en_US.UTF-8". Please translate the "C" locale setting for each language to the compatible locale in /wire/modules/LanguageSupport/LanguageSupport.module:
Default
For example, the locale setting for US English might be: en_US.UTF-8

In the page header I have this:

<!DOCTYPE html>
<html lang="de">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">

in config:

// Locale setting
setlocale(LC_ALL, 'de_DE.UTF-8');

The error message remains, even if I set the entry "C" under Default (the link in the error message) to de_DE.UTF-8 or en_US.UTF-8. Maybe I have to set a code for language selection in the header, instead of <html lang="en">? What did I forget?

Link to comment
Share on other sites

Hi Kaz, I am by no means an expert.

It *could* be a problem with the actual server variables, had a little "fun" with that end, working out what had changed when Siteground made some changes.
In my case, setting the timezone properly (again) solved my server problem.

Re: config my locale mirrors yours with the exception of setting $config->timezone as well.

$config->timezone = 'Australia/Brisbane';
setlocale(LC_ALL,'en_AU.UTF-8');

Hope you get it sorted, sorry I can't be of more assistance.

Link to comment
Share on other sites

The message suggests that the en_US.UTF-8 is already set in the "C" entry, so I guess the problem is that the server doesn't understand with that format. You can try to add several formats to that field so the server can use the one that it understands. Just enter them separated by commas: de_DE.UTF8, de.UTF8, de_DE.UTF-8, de.UTF-8 

...or add this to a file, and it will echo the first locale that is recognized by the server. Then you'll know which one to use:

<?php echo setlocale(LC_ALL, 'de_DE.UTF8', 'de.UTF8', 'de_DE.UTF-8', 'de.UTF-8');?>

 

Edited by diogo
removed quotes from locales list
Link to comment
Share on other sites

I did try it with:
setlocale(LC_ALL, 'de_DE.UTF8', 'de.UTF8', 'en_US.UTF-8', 'en.UTF-8');
in config.php + cleared cache

Then I tried adding the setting of the languages in the Translate LanguageSupport.module:
de_DE.UTF8, de.UTF8, en_US.UTF-8, en.UTF-8 + cleared cache
I have restored the entry in the config to setlocale(LC_ALL, 'de_DE.UTF-8');

The error message remains.

Perhaps a short explanation of the page:
I have replaced the default language to German, including installation of the language packs. A second language is not installed yet, is planned for later. The fields of the templates are already set to *Language, because it was possible after installing the language, a step in preparation for the second language.

Link to comment
Share on other sites

13 hours ago, kaz said:

the error is nonsensical

Rather than being nonsense, it actually tells you exactly what you need to do to fix the situation:

On 5/27/2021 at 7:27 PM, kaz said:

Please translate the "C" locale setting for each language to the compatible locale in /wire/modules/LanguageSupport/LanguageSupport.module

But maybe you haven't learned about translations in PW yet so you don't understand.

For each language in your site, navigate to Setup > Languages > [your language] and in the "Core Translation Files" field click the "Find Files To Translate" button.

Then locate the LanguageSupport.module, click on it to highlight it, and click the "Submit" button.

2021-05-29_101700.png.ec13f91d43e0e695afcaa2e868759a7f.png

Then locate the "C" item and translate it to the value that should be set via setlocale(LC_ALL, [value]) for that language.

2021-05-29_102137.png.c20c7b5e9fcac268c1ccfbdd6518bcc6.png

Now click "Save".

  • Like 1
Link to comment
Share on other sites

On 5/28/2021 at 3:16 PM, diogo said:

Also, what do you get when you echo this?


echo setlocale(LC_ALL, 0);

 

C

16 hours ago, Robin S said:

Rather than being nonsense, it actually tells you exactly what you need to do to fix the situation:

But maybe you haven't learned about translations in PW yet so you don't understand.

For each language in your site, navigate to Setup > Languages > [your language] and in the "Core Translation Files" field click the "Find Files To Translate" button.

Then locate the LanguageSupport.module, click on it to highlight it, and click the "Submit" button.

2021-05-29_101700.png.ec13f91d43e0e695afcaa2e868759a7f.png

Then locate the "C" item and translate it to the value that should be set via setlocale(LC_ALL, [value]) for that language.

2021-05-29_102137.png.c20c7b5e9fcac268c1ccfbdd6518bcc6.png

Now click "Save".

This was already done before I posted the article, the entry C is de_DE.UTF8, the default language. All entries are included. de_DE.UTF8 in 'C' Translate LanguageSupport.module, setlocale(LC_ALL, 'de_DE.UTF-8'); in config.php  The error message remains.

Link to comment
Share on other sites

"C" is the default value for the the "C" field in the translations, so I'm guessing it's taking it over your "de_DE.UTF8" ,

On 5/28/2021 at 10:30 AM, kaz said:

I did try it with:
setlocale(LC_ALL, 'de_DE.UTF8', 'de.UTF8', 'en_US.UTF-8', 'en.UTF-8');

I noticed that you are mixing different locale languages on that call to setlocale. The idea is to add different forms of locales for only one language, to find out which one is recognized by the server. Can you try exactly what I suggested above, and see which one of them is echoed?

<?php echo setlocale(LC_ALL, 'de_DE.UTF8', 'de.UTF8', 'de_DE.UTF-8', 'de.UTF-8');?>

Also, a correction to what I wrote before: If you add a list of locales to the "C" field, you should add them separated by commas, but without the quotation marks. 

de_DE.UTF8, de.UTF8, de_DE.UTF-8, de.UTF-8  instead of 'de_DE.UTF8', 'de.UTF8', 'de_DE.UTF-8', 'de.UTF-8' 

I modified my other post to reflect this.

 

  • Like 1
Link to comment
Share on other sites

@diogo it does not work, the error remains. No matter what I do, it doesn't change anything. The problem is probably in my system? Thank you for trying to help, but I don't want to try any more.

Link to comment
Share on other sites

The problem is in your system, it's missing utf8 locale. 'locale -a' in the terminal window will tell you what are available locales. If the problem would be benign, as you think, then PW would not warn you about it. 

Link to comment
Share on other sites

You still didn't say what is the result of echoing setlocale(LC_ALL, 'de_DE.UTF8', 'de.UTF8', 'de_DE.UTF-8', 'de.UTF-8') ?

Fair enough that you don't want to continue trying. Just keep in mind the purpose of this check, in case you have a related problem in the future. Has written in the code:

* Warning about servers with locales that break UTF-8 strings called by basename
* and other file functions, due to a long running PHP bug 

 

1 hour ago, matjazp said:

The problem is in your system, it's missing utf8 locale. 'locale -a' in the terminal window will tell you what are available locales. If the problem would be benign, as you think, then PW would not warn you about it. 

If you don't have ssh access to the server, you can also do this inside php var_dump(\ResourceBundle::getLocales(''));

  • Like 1
Link to comment
Share on other sites

On 5/29/2021 at 9:12 PM, diogo said:

You still didn't say what is the result of echoing setlocale(LC_ALL, 'de_DE.UTF8', 'de.UTF8', 'de_DE.UTF-8', 'de.UTF-8') ?

If you don't have ssh access to the server, you can also do this inside php var_dump(\ResourceBundle::getLocales(''));

I'm sorry: The echo has no output, not in frontent, not in source code.
My entry in C is: de_DE.UTF8, de.UTF8, de_DE.UTF-8, de.UTF-8
localhost is:
// setlocale(LC_ALL, 'de_DE.UTF8', 'de.UTF8', 'en_GB.utf8', 'en.UTF-8');
setlocale(LC_ALL, 'de_DE.UTF-8');

On 5/29/2021 at 9:12 PM, diogo said:

If you don't have ssh access to the server, you can also do this inside php var_dump(\ResourceBundle::getLocales(''));

I work localhost with XAMPP, macOS. I have no experiences with SSH.

Sorry about giving up. But when I don't see a change, then perhaps I give up too quickly.

Link to comment
Share on other sites

Last one. Try adding these 'de_DE@euro''de_DE''de''ge' to the end of the setlocale function to see if something comes out.

echo setlocale(LC_ALL, 'de_DE.UTF8', 'de.UTF8', 'de_DE.UTF-8', 'de.UTF-8', 'de_DE@euro', 'de_DE', 'de', 'ge');

 

Link to comment
Share on other sites

Ok, just out of curiosity, you mentioned you develop locally on XAMPP on macOS, I'm assuming that this problem is happening on the remote server and not on the local server, right? If so, is it a shared hosting German provider? Would be really strange if they don't have the German locale installed...

If I assumed wrong, and this is all happening on XAMPP, then I guess you're right and you don't need to worry too much, as it will likely work when you transfer it to the remote server.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...