Merge pull request #1834 from dpalou/MOBILE-2982

MOBILE-2982 lang: Fix load lang strings for plugins
main
Juan Leyva 2019-04-12 10:33:07 +02:00 committed by GitHub
commit 265f4a40f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -58,7 +58,7 @@ export class CoreLangProvider {
* @param {string} [prefix] A prefix to add to all keys. * @param {string} [prefix] A prefix to add to all keys.
*/ */
addSitePluginsStrings(lang: string, strings: any, prefix?: string): void { addSitePluginsStrings(lang: string, strings: any, prefix?: string): void {
lang = lang.replace('_', '-'); // Use the app format instead of Moodle format. lang = lang.replace(/_/g, '-'); // Use the app format instead of Moodle format.
// Initialize structure if it doesn't exist. // Initialize structure if it doesn't exist.
if (!this.sitePluginsStrings[lang]) { if (!this.sitePluginsStrings[lang]) {
@ -307,7 +307,7 @@ export class CoreLangProvider {
return; return;
} }
lang = values[2].replace('_', '-'); // Use the app format instead of Moodle format. lang = values[2].replace(/_/g, '-'); // Use the app format instead of Moodle format.
if (!this.customStrings[lang]) { if (!this.customStrings[lang]) {
this.customStrings[lang] = {}; this.customStrings[lang] = {};
@ -363,7 +363,7 @@ export class CoreLangProvider {
* @param {string} value String value. * @param {string} value String value.
*/ */
loadString(langObject: any, lang: string, key: string, value: string): void { loadString(langObject: any, lang: string, key: string, value: string): void {
lang = lang.replace('_', '-'); // Use the app format instead of Moodle format. lang = lang.replace(/_/g, '-'); // Use the app format instead of Moodle format.
if (this.translate.translations[lang]) { if (this.translate.translations[lang]) {
// The language is loaded. // The language is loaded.