Skip to content

Commit 6281ce1

Browse files
authored
Merge pull request #2515 from crazyserver/MOBILE-3548
MOBILE-3548 login: Add the option to easily change site url placeholder
2 parents 65a5401 + ba26279 commit 6281ce1

File tree

6 files changed

+25
-3
lines changed

6 files changed

+25
-3
lines changed

scripts/create_langindex.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,10 @@ function parse_file {
258258
value=`$exec`
259259
guess_file $key "$value"
260260
else
261-
if [ ! -z "$findbetter" ]; then
261+
if [ "$found" == 'donottranslate' ]; then
262+
# Do nothing since is not translatable.
263+
continue
264+
elif [ ! -z "$findbetter" ]; then
262265
exec="jq -r .\"$key\" $1"
263266
value=`$exec`
264267
find_better_file "$key" "$value" "$found"

scripts/lang_functions.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,18 @@ function build_lang($lang, $keys) {
210210
$string = get_translation_strings($langfoldername, $value->file, $override_langfolder);
211211
// Apply translations.
212212
if (!$string) {
213+
if ($value->file == 'donottranslate') {
214+
// Restore it form the json.
215+
if ($langFile && is_array($langFile) && isset($langFile[$key])) {
216+
$translations[$key] = $langFile[$key];
217+
} else {
218+
// If not present, do not count it in the total.
219+
$total--;
220+
}
221+
222+
continue;
223+
}
224+
213225
if (TOTRANSLATE) {
214226
echo "\n\t\tTo translate $value->string on $value->file";
215227
}
@@ -312,6 +324,10 @@ function detect_lang($lang, $keys) {
312324
$string = get_translation_strings($langfoldername, $value->file);
313325
// Apply translations.
314326
if (!$string) {
327+
// Do not count non translatable in the totals.
328+
if ($value->file == 'donottranslate') {
329+
$total--;
330+
}
315331
continue;
316332
}
317333

scripts/langindex.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,6 +1833,7 @@
18331833
"core.login.signupplugindisabled": "local_moodlemobileapp",
18341834
"core.login.signuprequiredfieldnotsupported": "local_moodlemobileapp",
18351835
"core.login.siteaddress": "local_moodlemobileapp",
1836+
"core.login.siteaddressplaceholder": "donottranslate",
18361837
"core.login.sitehasredirect": "local_moodlemobileapp",
18371838
"core.login.siteinmaintenance": "local_moodlemobileapp",
18381839
"core.login.sitepolicynotagreederror": "local_moodlemobileapp",

src/assets/lang/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,6 +1833,7 @@
18331833
"core.login.signupplugindisabled": "{{$a}} is not enabled.",
18341834
"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.",
18351835
"core.login.siteaddress": "Your site",
1836+
"core.login.siteaddressplaceholder": "https://campus.example.edu",
18361837
"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.",
18371838
"core.login.siteinmaintenance": "Your site is in maintenance mode",
18381839
"core.login.sitepolicynotagreederror": "Site policy not agreed.",

src/core/login/lang/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
"signupplugindisabled": "{{$a}} is not enabled.",
105105
"signuprequiredfieldnotsupported": "The signup form contains a required custom field that isn't supported in the app. Please create your account using a web browser.",
106106
"siteaddress": "Your site",
107+
"siteaddressplaceholder": "https://campus.example.edu",
107108
"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.",
108109
"siteinmaintenance": "Your site is in maintenance mode",
109110
"sitepolicynotagreederror": "Site policy not agreed.",

src/core/login/pages/site/site.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
<ng-container *ngIf="siteSelector == 'url'">
2121
<ion-item>
2222
<ion-label stacked><h2>{{ 'core.login.siteaddress' | translate }}</h2></ion-label>
23-
<ion-input name="url" type="url" placeholder="https://campus.example.edu" formControlName="siteUrl" [core-auto-focus]="showKeyboard && !showScanQR"></ion-input>
23+
<ion-input name="url" type="url" placeholder="{{ 'core.login.siteaddressplaceholder' | translate }}" formControlName="siteUrl" [core-auto-focus]="showKeyboard && !showScanQR"></ion-input>
2424
</ion-item>
2525
</ng-container>
2626
<ng-container *ngIf="siteSelector != 'url'">
2727
<ion-item>
2828
<ion-label stacked><h2>{{ 'core.login.siteaddress' | translate }}</h2></ion-label>
29-
<ion-input name="url" placeholder="https://campus.example.edu" formControlName="siteUrl" [core-auto-focus]="showKeyboard && !showScanQR" (ionChange)="searchSite($event, siteForm.value.siteUrl)"></ion-input>
29+
<ion-input name="url" placeholder="{{ 'core.login.siteaddressplaceholder' | translate }}" formControlName="siteUrl" [core-auto-focus]="showKeyboard && !showScanQR" (ionChange)="searchSite($event, siteForm.value.siteUrl)"></ion-input>
3030
</ion-item>
3131

3232
<ion-list [class.hidden]="!hasSites && !enteredSiteUrl" class="core-login-site-list">

0 commit comments

Comments
 (0)