MoodleMobile 3.2.1 Custom App "forcedefaultlanguage" issue

MoodleMobile 3.2.1 Custom App "forcedefaultlanguage" issue

by Yusuf Yilmaz -
Number of replies: 6

Hello There,


I have updated my custom moodle mobile app to the latest version 3.2.1 But I am having an issue with translations. My app has default lang option "tr" But when I build the app I am seeing the language's json keys rather than fallback language (english) I suspect that this is happening because www/config.json file has now "forcedefaultlanguage" option. It is set as default to "false" Anybody having the same issue?


Is this because from my development environment which I use windows7 and I had some node_modules failed to install during the upgrade. Any comment will be helpfull. 


Best

Average of ratings: -
In reply to Yusuf Yilmaz

Re: MoodleMobile 3.2.1 Custom App "forcedefaultlanguage" issue

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers

Hello Yusuf,

please check the following folder in your app's code:

www/build/lang

In there you should see one file per language (ar.json, bg.json, ...) with all the language strings. If these files aren't there or they're empty it means that the build process has failed. Please run gulp to build them and check if there is any error.

Kind regards,

Dani

In reply to Dani Palou

Re: MoodleMobile 3.2.1 Custom App "forcedefaultlanguage" issue

by Yusuf Yilmaz -

Hello Dani,


Thank you for your reply. The build folder looks fine "www/build/lang" All the langs files and their json contents look great. I also used json tool to confirm whether they have the valid json.


The problem continues. I have refined my scenario to check further.

For example I followed the below steps:

1. changed the www/config.json > "default_lang": "en"  (it had "tr" before")

2. run the gulp.

3. ionic serve

4. open the app in chrome

5. The app running smoothly in English language.

6. Tap on sidemenu> App settings>General>Change language to "Turkish"

7. The app now had Turkish translations with the English fallback. (that was expected from the app)


Above scenario is ok for English but when I try to change default langauge in "tr" it does not work as I expected. The app puts langauge keys rather than English fallback strings.

I think there is conflict somewhere in the app for language translation when it is considering the "forcedefaultlanguage" (www\core\lib\lang.js)


Any idea where to look at it?



In reply to Yusuf Yilmaz

Re: MoodleMobile 3.2.1 Custom App "forcedefaultlanguage" issue

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers

Hi Yusuf,

one of the things you should take into account is that the app remembers the current language when it's started. So changing the default_lang will only have effect if the app is uninstalled and reinstalled again (in a device). To reset this in browser you should go to the browser DB (usually IndexedDB), open the DB "MoodleMobile", go to the table/store named "config" and clear it.

You should check in $mmLang if there is something weird going on in there (www/core/lib/lang.js).

Cheers,

Dani

In reply to Dani Palou

Re: MoodleMobile 3.2.1 Custom App "forcedefaultlanguage" issue

by Yusuf Yilmaz -

Thank you for your effort Dani.


Unfortunately I have not resolved my problem yet. I believe this is a bug of the moodlemobile2. I have further investigated the issue on a clean virtual Ubuntu 16.04 installation. I have followed the steps on https://docs.moodle.org/dev/Setting_up_your_development_environment_for_Moodle_Mobile_2 


Here is my steps.

1. Follow instructions at https://docs.moodle.org/dev/Setting_up_your_development_environment_for_Moodle_Mobile_2 

2. Change "nothing" in the app files and confirm the moodlemobile raw app is running smoothly. (success, see picture below)



3. Change the "www/config.json" file from "default_lang": "en" to "default_lang": "tr"

4. gulp

5. ionic serve

6. Look for Turkish labels in the first page where siteurl is requested. The result is as I mention the issue from the begining. As you can see from the image below, app translates known Turkish language strings. For example "Connect!" is translated to "Bağlan!" successfully. But the rest of the translation is not appearing in Turkish. Because the language keys have not bee translated to Turkish yet. In this case, the translation should use English as fallback. But it does not!!!



In reply to Yusuf Yilmaz

Re: MoodleMobile 3.2.1 Custom App "forcedefaultlanguage" issue

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers

Hi Yusuf,

sorry for the trouble. I tried it with a fresh environment and I was able to reproduce the problem.

I created an issue to fix this:

https://tracker.moodle.org/browse/MOBILE-2075

Thanks for reporting this,

Dani

Average of ratings: Useful (1)