Moodle Mobile language strings customization

Moodle Mobile language strings customization

by Elton LaClare -
Number of replies: 4

Hello,

Recently I've been experimenting with customizing the language strings for Moodle Mobile. So far I've had mixed results depending on the language string identifier. For example, I was able to customize "Back" in the app header by adding mm.core.back|戻|ja to the custom language strings area of Site administration/Mobile app/Mobile features. However, when I attempted to customize "Submit" in the Lesson module by adding mma.mod_lesson.submit|次|ja it didn't work. 

I tried refreshing the page, logging out of the app, and deleting and reinstalling the app. None of these things had any effect.

I got the language string identifier from the list located here. Is there something I've done wrong?   

Attachment custom language strings.JPG
Average of ratings: -
In reply to Elton LaClare

Re: Moodle Mobile language strings customization

by Elton LaClare -

Just to add to my previous post... When looking at the app in various languages, it seems that sometimes language strings are presented in the selected language and sometimes they are not. For example, when using the Mobile app in Spanish, some parts of the Lesson module are presented in Spanish and others are not (see images). The same is true when Japanese is selected. I thought I could fix these inconsistencies by using the custom language strings area of Site administration/Mobile app/Mobile features, but so far I've not managed view my translation on the app. 

Has anyone had success customizing mobile language strings through the admin settings? If so, please let me know how you did it. I will be making a presentation about the Moodle Mobile app in Japan next week, and I would like to demonstrate a fully translated version.

Thank you. 

Attachment Spanish_Lesson1.png
Attachment Spanish_Lesson2.png
Average of ratings: Useful (1)
In reply to Elton LaClare

Re: Moodle Mobile language strings customization

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

Hi Elton,

when you see strings presented in a different language in the app it can be caused by 2 things:

  1. It's an app string that isn't translated in the current language, so the fallback (English) is used.
  2. It's a string that comes from Moodle, and the WebService is returning it in that language.

The submit button in the lesson belongs to the case 2. The app contains the string "submit" for lesson, but it is only used as a fallback:

submitButton = rootElement.querySelector('input[type="submit"]');

question.submitLabel = submitButton ? submitButton.value : $translate.instant('mma.mod_lesson.submit');

The app searches for the submit button in the page's HTML returned by the WebService, and uses the text of that button. If the app is unable to find a submit button (unlikely), then it uses 'mma.mod_lesson.submit' as a fallback.

I implemented it like this to make sure the value is the same as it's seen in web. If that value cannot be configured in web then we could always use the app string. I'll take a look.

Kind regards,

Dani

Average of ratings: Useful (1)
In reply to Dani Palou

Re: Moodle Mobile language strings customization

by Elton LaClare -

Dani,

Thank you for looking into this. I think I understand what's happening. Unfortunately, in the situation discussed here (i.e. the 'submit' button in the Lesson module), there seems to be no way to get the app to display the button in the user's language...

Shouldn't the app language string customization take precedence? 

In reply to Elton LaClare

Re: Moodle Mobile language strings customization

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

Hi Elton,

I checked it and all the questions use a similar code to determine the value to use in the submit button. We can try to replicate that code in the app so it uses the app strings instead of the value returned by the WebService.

I created an issue for this:

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

Kind regards,

Dani