diff --git a/apps/settings/index.html b/apps/settings/index.html index 0f5863b630bd..0f2da976a19b 100644 --- a/apps/settings/index.html +++ b/apps/settings/index.html @@ -2284,17 +2284,13 @@

+ --> diff --git a/apps/settings/js/support.js b/apps/settings/js/support.js new file mode 100644 index 000000000000..142a4961531c --- /dev/null +++ b/apps/settings/js/support.js @@ -0,0 +1,65 @@ +/* -*- Mode: js; js-indent-level: 2; indent-tabs-mode: nil -*- */ +/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ + +'use strict'; + +var Support = { + init: function support_init() { + this.loadSupportInfo(); + }, + + getSupportInfo: function support_getInfo(callback) { + if (this._supportInfo) { + callback(this._supportInfo); + return; + } + var self = this; + var SUPPORT_INFO = 'resources/support.json'; + var xhr = new XMLHttpRequest(); + xhr.onerror = function() { + console.error('Failed to fetch support.json: ', + xhr.statusText); + }; + xhr.onload = function loadSupportInfo() { + if (xhr.status === 0 || xhr.status === 200) { + self._supportInfo = xhr.response; + callback(self._supportInfo); + } + }; + xhr.open('GET', SUPPORT_INFO, true); // async + xhr.responseType = 'json'; + xhr.send(); + }, + + createLinkNode: function support_createLinkNode(data) { + var link = document.createElement('a'); + link.setAttribute('href', data.href); + link.textContent = data.title; + return link; + }, + + loadSupportInfo: function support_loadSupportInfo() { + var self = this; + this.getSupportInfo(function displaySupportInfo(supportInfo) { + document.getElementById('online-support-link') + .setAttribute('href', supportInfo.onlinesupport.href); + document.getElementById('online-support-text') + .textContent = supportInfo.onlinesupport.title; + + var callSupportInfo = supportInfo.callsupport; + var numbers = document.getElementById('call-support-numbers'); + if (callSupportInfo.length < 2) { + numbers.appendChild(self.createLinkNode(callSupportInfo[0])); + } else { + var link1 = self.createLinkNode(callSupportInfo[0]); + var link2 = self.createLinkNode(callSupportInfo[1]); + numbers.innerHTML = navigator.mozL10n + .get('call-support-numbers', { 'link1': link1.outerHTML, + 'link2': link2.outerHTML }); + } + }); + } +}; + +// startup +onLocalized(Support.init.bind(Support)); diff --git a/apps/settings/locales/settings.en-US.properties b/apps/settings/locales/settings.en-US.properties index 1a4758abf4c3..18c96a16d180 100644 --- a/apps/settings/locales/settings.en-US.properties +++ b/apps/settings/locales/settings.en-US.properties @@ -522,20 +522,8 @@ crash-reports-description-3-end=. # Device :: Help online-support=Online support: -# LOCALIZATION NOTE (online-support.href): this is the URL for the online support page. -online-support.href=http://www.vivo.com.br/portalweb/appmanager/env/web?_nfls=false&_nfpb=true&_pageLabel=vcAtendMovelBook&WT.ac=portal.atendimento.movel -# LOCALIZATION NOTE (online-support-link-text): This text will appear as a link. -online-support-link-text=Vivo call-support=Call support: -# LOCALIZATION NOTE (call-support-link-1): this text will appear as a link. -call-support-link-1=*8486 -# LOCALIZATION NOTE (call-support-link-1.href): include the "tel:" protocol before the call support -# number so that it will open in the dialer app. -call-support-link-1.href=tel:*8486 -# LOCALIZATION NOTE: if your locale only has one support phone number, leave the next 3 strings empty. -call-support-link-2=1058 -call-support-link-2.href=tel:1058 -call-support-link-or=or +call-support-numbers={{link1}} or {{link2}} user-guide=User guide # Device :: SIM toolkit diff --git a/apps/settings/locales/settings.fr.properties b/apps/settings/locales/settings.fr.properties index 59fd78a2ed85..b478d494b1fc 100644 --- a/apps/settings/locales/settings.fr.properties +++ b/apps/settings/locales/settings.fr.properties @@ -514,20 +514,8 @@ crash-reports-description-3-end=. # Device :: Help online-support=Aide en ligne : -# LOCALIZATION NOTE (online-support.href): This is the URL for the online support page. -online-support.href=http://www.vivo.com.br/portalweb/appmanager/env/web?_nfls=false&_nfpb=true&_pageLabel=vcAtendMovelBook&WT.ac=portal.atendimento.movel -# LOCALIZATION NOTE (online-support-link-text): This text will appear as a link. -online-support-link-text=Vivo call-support=Aide par téléphone : -# LOCALIZATION NOTE (call-support-link-1): This text will appear as a link. -call-support-link-1=*8486 -# LOCALIZATION NOTE (call-support-link-1.href): Include the "tel:" protocol before the call support -# number so that it will open in the dialer app. -call-support-link-1.href=tel:*8486 -# LOCALIZATION NOTE: If your locale only has one support phone number, leave the next 3 strings empty. -call-support-link-2= -call-support-link-2.href= -call-support-link-or= +call-support-numbers={{link1}} ou {{link2}} user-guide=Manuel de l’utilisateur # Device :: SIM Toolkit diff --git a/apps/settings/locales/settings.zh-TW.properties b/apps/settings/locales/settings.zh-TW.properties index 8dbbde52d210..3ee515f1f0c8 100644 --- a/apps/settings/locales/settings.zh-TW.properties +++ b/apps/settings/locales/settings.zh-TW.properties @@ -485,20 +485,8 @@ crash-reports-description-3-end=所描述的方式處理您的資訊。 # Device :: Help online-support=線上支援: -# LOCALIZATION NOTE (online-support.href): this is the URL for the online support page. -online-support.href=http://www.vivo.com.br/portalweb/appmanager/env/web?_nfls=false&_nfpb=true&_pageLabel=vcAtendMovelBook&WT.ac=portal.atendimento.movel -# LOCALIZATION NOTE (online-support-link-text): This text will appear as a link. -online-support-link-text=Vivo call-support=撥打技術支援電話: -# LOCALIZATION NOTE (call-support-link-1): this text will appear as a link. -call-support-link-1=*8486 -# LOCALIZATION NOTE (call-support-link-1.href): include the "tel:" protocol before the call support -# number so that it will open in the dialer app. -call-support-link-1.href=tel:*8486 -# LOCALIZATION NOTE: if your locale only has one support phone number, leave the next 3 strings empty. -call-support-link-2=1058 -call-support-link-2.href=tel:1058 -call-support-link-or=或 +call-support-numbers={{link1}} 或 {{link2}} user-guide=使用者指南 # Device :: SIM toolkit diff --git a/apps/settings/style/settings.css b/apps/settings/style/settings.css index ce25d0ad2cdb..e7890364f7b1 100644 --- a/apps/settings/style/settings.css +++ b/apps/settings/style/settings.css @@ -85,7 +85,7 @@ section[role="region"]:not(#root) > header:first-child + * { white-space: normal; } -.link-text, .tel-text { +.link-text, .tel-text a { font-size: 1.4rem; color: #336699; text-decoration: underline; diff --git a/build/applications-data.js b/build/applications-data.js index 7e0e975a56f8..0f2ecc39e582 100644 --- a/build/applications-data.js +++ b/build/applications-data.js @@ -195,3 +195,23 @@ content = { } writeContent(init, JSON.stringify(content)); + +// Support +init = getFile(GAIA_DIR, 'apps', 'settings', 'resources', 'support.json'); +content = { + "onlinesupport": { + "href": "http://www.vivo.com.br/portalweb/appmanager/env/web?_nfls=false&_nfpb=true&_pageLabel=vcAtendMovelBook&WT.ac=portal.atendimento.movel", + "title": "Vivo" + }, + "callsupport": [ + { + "href": "tel:*8486", + "title": "*8486" + }, + { + "href": "tel:1058", + "title": "1058" + } + ] +} +writeContent(init, JSON.stringify(content)); diff --git a/shared/js/l10n.js b/shared/js/l10n.js index ccbde9b8bab2..07706ed5d2c7 100644 --- a/shared/js/l10n.js +++ b/shared/js/l10n.js @@ -821,7 +821,7 @@ // replace {{arguments}} with their values function substArguments(str, args, key) { - var reArgs = /\{\{\s*([a-zA-Z\.:-]+)\s*\}\}/; + var reArgs = /\{\{\s*(.+?)\s*\}\}/; var match = reArgs.exec(str); while (match) { if (!match || match.length < 2)