MOBILE-3313 about: Do not translate device OS

main
Pau Ferrer Ocaña 2020-01-29 13:22:18 +01:00
parent a3e7c676fb
commit 03e93ff6c8
5 changed files with 14 additions and 22 deletions

View File

@ -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",

View File

@ -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",

View File

@ -51,8 +51,7 @@
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.deviceOs" (longPress)="copyItemInfo($event)">
<h2>{{ 'core.settings.deviceos' | translate}}</h2>
<p *ngIf="deviceOSTranslatable">{{ 'core.' + deviceInfo.deviceOs | translate }}</p>
<p *ngIf="!deviceOSTranslatable">{{ deviceInfo.deviceOs }}</p>
<p>{{ deviceInfo.deviceOsTranslated }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.screen" (longPress)="copyItemInfo($event)">
<h2>{{ 'core.settings.screen' | translate}}</h2>

View File

@ -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');
}
}
}

View File

@ -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",