Subject: Issue with Changing Language in User Account Creation Messages

melo lobo Posted in Beginning Developers 3 months ago

Dear Arsalan & Michael;

I trust this message finds you well. I am reaching out to bring to your attention a challenge I have encountered while attempting to manipulate the language of messages displayed during user account creation.

After conducting thorough investigations, I have observed that these messages appear to depend on the default language stored in the "ossn_site_settings" table. In an effort to address this issue, I attempted to enforce a language change using the following code:

global $Ossn;
$Ossn->siteSettings->language = 'ar';

However, despite this attempt, the problem persists. Specifically, the call to the ossn_print("account:created:email") function continues to return "account:created:email" instead of the expected text in the new language.

I seek your assistance and guidance in understanding why the language modification through the aforementioned code does not seem to affect the message returned by the ossn_print() function in action/user/register. If you have any suggestions on how to resolve this issue or recommendations for alternative approaches, I would greatly appreciate your input.

I am available to provide additional information if needed and appreciate your valuable assistance in advance.

Best regards,

Replies
German Michael Zülsdorff Replied 2 months ago

Okay,
but then "Specifically, the call to the ossn_print("account:created:email") function continues to return "account:created:email" instead of the expected text in the new language." leads to question:
Where please should Ossn get that "expected text" from if you don't (want to) define it?

Ossn's language system is based on just simple key => value pairs. And if there's no such value available, it is coded to return the key instead.

ma Melo lobo Replied 2 months ago

Mr Michael

First and foremost, I would like to emphasize that my primary objective is not to exclusively define the Arabic language or any other specific language on the site. On the contrary, my ambition is to create an innovative system that will allow users to choose their preferred language right from the start of their experience on the site.

To achieve this goal, I have been working on integrating a language management system that will provide our users with the ability to interact with the site in the language that suits them best. This means that from their very first visit to the site, users will have the freedom to select the language in which they wish to navigate, register, and interact with all elements of the site, including error messages and homepage content.

I want to emphasize that this system will not depend solely on the language defined by the site administrator. Instead, it will offer users total flexibility, allowing them to choose their own linguistic experience without any constraints.

German Michael Zülsdorff Replied 3 months ago
  1. Read https://www.opensource-socialnetwork.org/wiki/view/2132/how-to-translate-ossn
  2. create the necessary language files of type ossn.ar.php with Arabic translations
  3. Choose Arabic at your adminstrator backend via Site Settings -> Basic -> Default Language