From ba2627960c742a192345bc7cfff9d41d4ebed2a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Tue, 8 Sep 2020 12:00:01 +0200 Subject: [PATCH] MOBILE-3548 login: Add the option to easily change site url placeholder --- scripts/create_langindex.sh | 5 ++++- scripts/lang_functions.php | 16 ++++++++++++++++ scripts/langindex.json | 1 + src/assets/lang/en.json | 1 + src/core/login/lang/en.json | 1 + src/core/login/pages/site/site.html | 4 ++-- 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/scripts/create_langindex.sh b/scripts/create_langindex.sh index d35ba1d74..9a82b64e0 100755 --- a/scripts/create_langindex.sh +++ b/scripts/create_langindex.sh @@ -258,7 +258,10 @@ function parse_file { value=`$exec` guess_file $key "$value" else - if [ ! -z "$findbetter" ]; then + if [ "$found" == 'donottranslate' ]; then + # Do nothing since is not translatable. + continue + elif [ ! -z "$findbetter" ]; then exec="jq -r .\"$key\" $1" value=`$exec` find_better_file "$key" "$value" "$found" diff --git a/scripts/lang_functions.php b/scripts/lang_functions.php index ea94ec3d1..668070a60 100644 --- a/scripts/lang_functions.php +++ b/scripts/lang_functions.php @@ -210,6 +210,18 @@ function build_lang($lang, $keys) { $string = get_translation_strings($langfoldername, $value->file, $override_langfolder); // Apply translations. if (!$string) { + if ($value->file == 'donottranslate') { + // Restore it form the json. + if ($langFile && is_array($langFile) && isset($langFile[$key])) { + $translations[$key] = $langFile[$key]; + } else { + // If not present, do not count it in the total. + $total--; + } + + continue; + } + if (TOTRANSLATE) { echo "\n\t\tTo translate $value->string on $value->file"; } @@ -312,6 +324,10 @@ function detect_lang($lang, $keys) { $string = get_translation_strings($langfoldername, $value->file); // Apply translations. if (!$string) { + // Do not count non translatable in the totals. + if ($value->file == 'donottranslate') { + $total--; + } continue; } diff --git a/scripts/langindex.json b/scripts/langindex.json index e9042291a..df9739345 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -1833,6 +1833,7 @@ "core.login.signupplugindisabled": "local_moodlemobileapp", "core.login.signuprequiredfieldnotsupported": "local_moodlemobileapp", "core.login.siteaddress": "local_moodlemobileapp", + "core.login.siteaddressplaceholder": "donottranslate", "core.login.sitehasredirect": "local_moodlemobileapp", "core.login.siteinmaintenance": "local_moodlemobileapp", "core.login.sitepolicynotagreederror": "local_moodlemobileapp", diff --git a/src/assets/lang/en.json b/src/assets/lang/en.json index e5df56003..6d3fd2ffe 100644 --- a/src/assets/lang/en.json +++ b/src/assets/lang/en.json @@ -1833,6 +1833,7 @@ "core.login.signupplugindisabled": "{{$a}} is not enabled.", "core.login.signuprequiredfieldnotsupported": "The signup form contains a required custom field that isn't supported in the app. Please create your account using a web browser.", "core.login.siteaddress": "Your site", + "core.login.siteaddressplaceholder": "https://campus.example.edu", "core.login.sitehasredirect": "Your site contains at least one HTTP redirect. The app cannot follow redirects, this could be the issue that's preventing the app from connecting to your site.", "core.login.siteinmaintenance": "Your site is in maintenance mode", "core.login.sitepolicynotagreederror": "Site policy not agreed.", diff --git a/src/core/login/lang/en.json b/src/core/login/lang/en.json index fb28b87c2..e94739407 100644 --- a/src/core/login/lang/en.json +++ b/src/core/login/lang/en.json @@ -104,6 +104,7 @@ "signupplugindisabled": "{{$a}} is not enabled.", "signuprequiredfieldnotsupported": "The signup form contains a required custom field that isn't supported in the app. Please create your account using a web browser.", "siteaddress": "Your site", + "siteaddressplaceholder": "https://campus.example.edu", "sitehasredirect": "Your site contains at least one HTTP redirect. The app cannot follow redirects, this could be the issue that's preventing the app from connecting to your site.", "siteinmaintenance": "Your site is in maintenance mode", "sitepolicynotagreederror": "Site policy not agreed.", diff --git a/src/core/login/pages/site/site.html b/src/core/login/pages/site/site.html index ccf57c53d..206a04603 100644 --- a/src/core/login/pages/site/site.html +++ b/src/core/login/pages/site/site.html @@ -20,13 +20,13 @@

{{ 'core.login.siteaddress' | translate }}

- +

{{ 'core.login.siteaddress' | translate }}

- +