From 03e93ff6c880a6ded79f05c383b533ef1c2a1e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 29 Jan 2020 13:22:18 +0100 Subject: [PATCH] MOBILE-3313 about: Do not translate device OS --- scripts/langindex.json | 5 ----- src/assets/lang/en.json | 5 ----- .../settings/pages/deviceinfo/deviceinfo.html | 3 +-- .../settings/pages/deviceinfo/deviceinfo.ts | 18 +++++++++++++----- src/lang/en.json | 5 ----- 5 files changed, 14 insertions(+), 22 deletions(-) diff --git a/scripts/langindex.json b/scripts/langindex.json index 8c2b64ff3..7698eff26 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -1322,7 +1322,6 @@ "core.all": "moodle", "core.allgroups": "moodle", "core.allparticipants": "moodle", - "core.android": "local_moodlemobileapp", "core.answer": "moodle", "core.answered": "quiz", "core.areyousure": "moodle", @@ -1653,14 +1652,12 @@ "core.imageviewer": "local_moodlemobileapp", "core.info": "moodle", "core.invalidformdata": "error", - "core.ios": "local_moodlemobileapp", "core.labelsep": "langconfig", "core.lastaccess": "moodle", "core.lastdownloaded": "local_moodlemobileapp", "core.lastmodified": "moodle", "core.lastsync": "local_moodlemobileapp", "core.layoutgrid": "workshopform_rubric", - "core.linux": "local_moodlemobileapp", "core.list": "moodle", "core.listsep": "langconfig", "core.loading": "moodle", @@ -1762,7 +1759,6 @@ "core.login.visitchangepassword": "local_moodlemobileapp", "core.login.webservicesnotenabled": "local_moodlemobileapp", "core.lostconnection": "local_moodlemobileapp", - "core.mac": "local_moodlemobileapp", "core.mainmenu.appsettings": "local_moodlemobileapp", "core.mainmenu.changesite": "local_moodlemobileapp", "core.mainmenu.help": "moodle", @@ -2074,7 +2070,6 @@ "core.whoops": "local_moodlemobileapp", "core.whyisthishappening": "local_moodlemobileapp", "core.whyisthisrequired": "moodle", - "core.windows": "local_moodlemobileapp", "core.wsfunctionnotavailable": "local_moodlemobileapp", "core.year": "moodle", "core.years": "moodle", diff --git a/src/assets/lang/en.json b/src/assets/lang/en.json index fbc81cd70..9b1c212b2 100644 --- a/src/assets/lang/en.json +++ b/src/assets/lang/en.json @@ -1322,7 +1322,6 @@ "core.all": "All", "core.allgroups": "All groups", "core.allparticipants": "All participants", - "core.android": "Android", "core.answer": "Answer", "core.answered": "Answered", "core.areyousure": "Are you sure?", @@ -1653,14 +1652,12 @@ "core.imageviewer": "Image viewer", "core.info": "Information", "core.invalidformdata": "Incorrect form data", - "core.ios": "iOS", "core.labelsep": ":", "core.lastaccess": "Last access", "core.lastdownloaded": "Last downloaded", "core.lastmodified": "Last modified", "core.lastsync": "Last synchronisation", "core.layoutgrid": "Grid", - "core.linux": "Linux", "core.list": "List", "core.listsep": ",", "core.loading": "Loading", @@ -1762,7 +1759,6 @@ "core.login.visitchangepassword": "Do you want to visit the site to change the password?", "core.login.webservicesnotenabled": "Web services are not enabled in your site. Please contact your site administrator if you think they should be enabled.", "core.lostconnection": "Your authentication token is invalid or has expired. You will have to reconnect to the site.", - "core.mac": "MacOS", "core.mainmenu.appsettings": "App settings", "core.mainmenu.changesite": "Change site", "core.mainmenu.help": "Help", @@ -2074,7 +2070,6 @@ "core.whoops": "Oops!", "core.whyisthishappening": "Why is this happening?", "core.whyisthisrequired": "Why is this required?", - "core.windows": "Windows", "core.wsfunctionnotavailable": "The web service function is not available.", "core.year": "year", "core.years": "years", diff --git a/src/core/settings/pages/deviceinfo/deviceinfo.html b/src/core/settings/pages/deviceinfo/deviceinfo.html index a9ff41c8f..3dc0d042b 100644 --- a/src/core/settings/pages/deviceinfo/deviceinfo.html +++ b/src/core/settings/pages/deviceinfo/deviceinfo.html @@ -51,8 +51,7 @@

{{ 'core.settings.deviceos' | translate}}

-

{{ 'core.' + deviceInfo.deviceOs | translate }}

-

{{ deviceInfo.deviceOs }}

+

{{ deviceInfo.deviceOsTranslated }}

{{ 'core.settings.screen' | translate}}

diff --git a/src/core/settings/pages/deviceinfo/deviceinfo.ts b/src/core/settings/pages/deviceinfo/deviceinfo.ts index 59cf15b0a..266b6cdc7 100644 --- a/src/core/settings/pages/deviceinfo/deviceinfo.ts +++ b/src/core/settings/pages/deviceinfo/deviceinfo.ts @@ -16,6 +16,7 @@ import { Component, NgZone } from '@angular/core'; import { IonicPage, Platform } from 'ionic-angular'; import { Device } from '@ionic-native/device'; import { Network } from '@ionic-native/network'; +import { TranslateService } from '@ngx-translate/core'; import { CoreAppProvider } from '@providers/app'; import { CoreFileProvider } from '@providers/file'; import { CoreInitDelegate } from '@providers/init'; @@ -68,9 +69,9 @@ interface CoreSettingsDeviceInfo { export class CoreSettingsDeviceInfoPage { deviceInfo: CoreSettingsDeviceInfo; + deviceOsTranslated: string; currentLangName: string; fsClickable: boolean; - deviceOSTranslatable: boolean; protected onlineObserver: any; @@ -85,7 +86,8 @@ export class CoreSettingsDeviceInfoPage { sitesProvider: CoreSitesProvider, localNotificationsProvider: CoreLocalNotificationsProvider, pushNotificationsProvider: CorePushNotificationsProvider, - protected utils: CoreUtilsProvider) { + protected utils: CoreUtilsProvider, + protected translate: TranslateService) { this.deviceInfo = { versionName: CoreConfigConstants.versionname, @@ -132,37 +134,43 @@ export class CoreSettingsDeviceInfoPage { } } - this.deviceOSTranslatable = true; if (appProvider.isMobile()) { this.deviceInfo.deviceType = platform.is('tablet') ? 'tablet' : 'phone'; if (appProvider.isAndroid()) { this.deviceInfo.deviceOs = 'android'; + this.deviceOsTranslated = 'Android'; } else if (appProvider.isIOS()) { this.deviceInfo.deviceOs = 'ios'; + this.deviceOsTranslated = 'iOS'; } else { const matches = navigator.userAgent.match(/\(([^\)]*)\)/); if (matches && matches.length > 1) { - this.deviceOSTranslatable = false; this.deviceInfo.deviceOs = matches[1]; + this.deviceOsTranslated = matches[1]; } else { this.deviceInfo.deviceOs = 'unknown'; + this.deviceOsTranslated = this.translate.instant('core.unknown'); } } } else { this.deviceInfo.deviceType = appProvider.isDesktop() ? 'desktop' : 'browser'; if (appProvider.isLinux()) { this.deviceInfo.deviceOs = 'linux'; + this.deviceOsTranslated = 'Linux'; } else if (appProvider.isMac()) { this.deviceInfo.deviceOs = 'mac'; + this.deviceOsTranslated = 'MacOS'; } else if (appProvider.isWindows()) { this.deviceInfo.deviceOs = 'windows'; + this.deviceOsTranslated = 'Windows'; } else { const matches = navigator.userAgent.match(/\(([^\)]*)\)/); if (matches && matches.length > 1) { - this.deviceOSTranslatable = false; this.deviceInfo.deviceOs = matches[1]; + this.deviceOsTranslated = matches[1]; } else { this.deviceInfo.deviceOs = 'unknown'; + this.deviceOsTranslated = this.translate.instant('core.unknown'); } } } diff --git a/src/lang/en.json b/src/lang/en.json index 5ca62b1b9..3070abb21 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -6,7 +6,6 @@ "all": "All", "allgroups": "All groups", "allparticipants": "All participants", - "android": "Android", "answer": "Answer", "answered": "Answered", "areyousure": "Are you sure?", @@ -120,7 +119,6 @@ "imageviewer": "Image viewer", "info": "Information", "invalidformdata": "Incorrect form data", - "ios": "iOS", "labelsep": ":", "filter": "Filter", "lastaccess": "Last access", @@ -128,14 +126,12 @@ "lastmodified": "Last modified", "lastsync": "Last synchronisation", "layoutgrid": "Grid", - "linux": "Linux", "list": "List", "listsep": ",", "loading": "Loading", "loadmore": "Load more", "location": "Location", "lostconnection": "Your authentication token is invalid or has expired. You will have to reconnect to the site.", - "mac": "MacOS", "maxsizeandattachments": "Maximum file size: {{$a.size}}, maximum number of files: {{$a.attachments}}", "min": "min", "mins": "mins", @@ -299,7 +295,6 @@ "whoops": "Oops!", "whyisthishappening": "Why is this happening?", "whyisthisrequired": "Why is this required?", - "windows": "Windows", "wsfunctionnotavailable": "The web service function is not available.", "year": "year", "years": "years",