The country on my register page was Chinese but my primary language is English
Hi @xabcdeianyi and welcome to the forum! Could you provide more details on your issue?
i had change all my language into en
Hi @xabcdeianyi,
Can you clarify where you needed to change the languages into English? I’d like to track this down to determine whether it’s a misconfiguration or a bug.
Thanks,
Alec Smecher
Public Knowledge Project Team
Hi @xabcdeianyi,
It’s likely that your server doesn’t have the English language country list (ISO3166) enabled and generated. We use the php-isocodes
library to provide country lists (and languages and a few others), and that library in turn uses PHP’s dgettext
function to get the translated country name. If the language isn’t translated into the language you expect, it’s probably because dgettext
couldn’t resolve the language-specific content it was asked to find.
Regards,
Alec Smecher
Public Knowledge Project Team
Thank you for the great explanations. It seems to be the problem. Unfortunately, I am really a rookie about this and would you please kindly tell me more details and maybe step by step that how I can reset my server or the system to make it happen? I am looking forward to your reply.
Hi @xabcdeianyi,
You will probably need to work with your host to get the support added to your server. The quickest way to demonstrate the problem will be to follow these steps on your server:
- In an empty directory, use Composer to install the php-isocodes library version 3.0.6 (the version OJS uses):
composer require sokil/php-isocodes 3.0.6
- Create a test script called e.g.
test.php
with the following contents (based on the php-isocodes sample code):<?php // Load php-isocodes library require_once('vendor/autoload.php'); // Set the current locale putenv('LANGUAGE=en_US.UTF-8'); putenv('LC_ALL=en_US.UTF-8'); setlocale(LC_ALL, 'en_US.UTF-8'); // Show the localized name for CA (Canada) $isoCodes = new \Sokil\IsoCodes\IsoCodesFactory(); echo $isoCodes->getCountries()->getByAlpha2('CA')->getLocalName() . "\n";
- Run the script:
php test.php
The result should be Canada
. You can change the locale from en_US
(American English) to something else (e.g. ar_IQ
for Arabic) and if the system supports it you will see the localized equivalent instead (كندا
).
If we have understood the problem, you will get the Chinese equivalent for “Canada”, when it should be in English. If that’s correct, you can show this to your host and they’ll be able to correct the problem by installing support for the en_US
locale (UTF-8
encoding).
Regards,
Alec Smecher
Public Knowledge Project Team