Skip to content

Commit 1bb0b1b

Browse files
committed
Merge pull request #1624 from uProxy/lucyhe-translatelogs
Translate view-logs.html
2 parents 11beca2 + 8facb29 commit 1bb0b1b

File tree

12 files changed

+48
-41
lines changed

12 files changed

+48
-41
lines changed

Gruntfile.coffee

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ taskManager.add 'build_chrome_ext', [
4444
'browserify:chromeExtMain'
4545
'browserify:chromeContext'
4646
'browserify:chromeVulcanized'
47+
'browserify:chromeLogsVulcanized'
4748
'string-replace:chromeExtVulcanized'
49+
'string-replace:chromeExtLogsVulcanized'
4850
]
4951

5052
taskManager.add 'build_chrome', [
@@ -63,8 +65,10 @@ taskManager.add 'build_firefox', [
6365
'vulcanize:firefoxViewLogsInline'
6466
'vulcanize:firefoxViewLogsCsp'
6567
'string-replace:firefoxVulcanized'
68+
'string-replace:firefoxLogsVulcanized'
6669
'browserify:firefoxContext'
6770
'browserify:firefoxVulcanized'
71+
'browserify:firefoxLogsVulcanized'
6872
]
6973

7074
# --- Testing tasks ---
@@ -220,17 +224,17 @@ FILES =
220224
]
221225

222226
#------------------------------------------------------------------------------
223-
finishVulcanized = (basePath) ->
227+
finishVulcanized = (basePath, baseFilename) ->
224228
files: [
225229
{
226-
src: path.join(basePath, '/polymer/vulcanized.html')
227-
dest: path.join(basePath, '/polymer/vulcanized.html')
230+
src: path.join(basePath, '/polymer/' + baseFilename + '.html')
231+
dest: path.join(basePath, '/polymer/' + baseFilename + '.html')
228232
}
229233
]
230234
options:
231235
replacements: [{
232-
pattern: /vulcanized\.js/
233-
replacement: 'vulcanized.static.js'
236+
pattern: baseFilename + '.js'
237+
replacement: baseFilename + '.static.js'
234238
}, {
235239
pattern: /<script src=\"[a-zA-Z_./]+third_party\/bower\/([^"]+)"><\/script>/
236240
replacement: '<script src="../lib/$1"></script>'
@@ -655,10 +659,16 @@ module.exports = (grunt) ->
655659
'freedom-social-firebase': '<%= pkgs.freedomfirebase.version %>'
656660
}]
657661
chromeExtVulcanized:
658-
finishVulcanized(chromeExtDevPath + '/generic_ui')
662+
finishVulcanized(chromeExtDevPath + '/generic_ui', 'vulcanized')
663+
659664
firefoxVulcanized:
660-
finishVulcanized(firefoxDevPath + '/data/generic_ui')
665+
finishVulcanized(firefoxDevPath + '/data/generic_ui', 'vulcanized')
666+
667+
chromeExtLogsVulcanized:
668+
finishVulcanized(chromeExtDevPath + '/generic_ui', 'vulcanized-view-logs')
661669

670+
firefoxLogsVulcanized:
671+
finishVulcanized(firefoxDevPath + '/data/generic_ui', 'vulcanized-view-logs')
662672

663673
#-------------------------------------------------------------------------
664674
# All typescript compiles to locations in `build/`
@@ -712,6 +722,7 @@ module.exports = (grunt) ->
712722
)
713723

714724
chromeVulcanized: Rule.browserify('chrome/extension/generic_ui/polymer/vulcanized', {})# no exports from this
725+
chromeLogsVulcanized: Rule.browserify('chrome/extension/generic_ui/polymer/vulcanized-view-logs', {})
715726
firefoxContext:
716727
src: [
717728
firefoxDevPath + '/data/scripts/background.js'
@@ -721,6 +732,7 @@ module.exports = (grunt) ->
721732
browserifyOptions:
722733
standalone: 'ui_context'
723734
firefoxVulcanized: Rule.browserify('firefox/data/generic_ui/polymer/vulcanized', {})# no exports from this
735+
firefoxLogsVulcanized: Rule.browserify('firefox/data/generic_ui/polymer/vulcanized-view-logs', {})
724736

725737
chromeExtensionCoreConnector: Rule.browserify 'chrome/extension/scripts/chrome_core_connector'
726738
chromeExtensionCoreConnectorSpec: Rule.browserifySpec 'chrome/extension/scripts/chrome_core_connector'

src/generic_core/globals.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export var settings :uproxy_core_api.GlobalSettings = {
3838
version: STORAGE_VERSION,
3939
statsReportingEnabled: false,
4040
consoleFilter: loggingTypes.Level.warn,
41-
language: 'en-US'
41+
language: 'en'
4242
};
4343

4444
export var natType :string = '';
@@ -73,7 +73,7 @@ export var loadSettings :Promise<void> =
7373
settings.statsReportingEnabled = false;
7474
}
7575
if (settings.language == null) {
76-
settings.language = 'en-US';
76+
settings.language = 'en';
7777
}
7878
}).catch((e) => {
7979
log.info('No global settings loaded', e.message);

src/generic_ui/faq.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<html>
22
<head>
3+
<meta charset="UTF-8">
34
<title>uProxy FAQ</title>
45
<link href='fonts/Roboto.css' rel='stylesheet' type='text/css'>
56
<style type='text/css'>

src/generic_ui/locales/ar/messages.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,8 @@
276276
"description": "Title for the page that displays a user's network information and uProxy logs."
277277
},
278278
"toSendLogs": {
279-
"message": "لإرسال السجلات الخاصة بك للفريق uProxy للمساعدة:",
280-
"description": "Instructions guiding the user through how to submit their logs to uProxy (part 1)."
281-
},
282-
"openFeedback": {
283-
"message": "فتح uProxy وانقر فوق \"إرسال ملاحظات\"",
284-
"description": "Instructions guiding the user through how to submit their logs to uProxy (part 2). This text is clickable and will open uProxy."
279+
"message": "لإرسال السجلات الخاصة بك للفريق uProxy للحصول على المساعدة، وفتح uProxy وانقر على زر \"إرسال ملاحظات\"",
280+
"description": "Instructions guiding the user through how to submit their logs to uProxy."
285281
},
286282
"retrievingLogs": {
287283
"message": "استرجاع السجلات وتحليل الشبكة ...",

src/generic_ui/locales/en/messages.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,8 @@
276276
"message": "Logs & Network Analysis"
277277
},
278278
"toSendLogs": {
279-
"description": "Instructions guiding the user through how to submit their logs to uProxy (part 1).",
280-
"message": "To send your logs to the uProxy team for help:"
281-
},
282-
"openFeedback": {
283-
"description": "Instructions guiding the user through how to submit their logs to uProxy (part 2). This text is clickable and will open uProxy.",
284-
"message": "open uProxy and click 'Submit Feedback'"
279+
"description": "Instructions guiding the user through how to submit their logs to uProxy.",
280+
"message": "To send your logs to the uProxy team for help, open uProxy and click 'Submit Feedback'"
285281
},
286282
"retrievingLogs": {
287283
"description": "Message shown while uProxy is analyzing the user's network settings.",

src/generic_ui/locales/fa/messages.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,8 @@
276276
"description": "Title for the page that displays a user's network information and uProxy logs."
277277
},
278278
"toSendLogs": {
279-
"message": "برای ارسال سیاهههای مربوط خود را به تیم uProxy برای کمک:",
280-
"description": "Instructions guiding the user through how to submit their logs to uProxy (part 1)."
281-
},
282-
"openFeedback": {
283-
"message": "باز uProxy و بر روی \"ارسال ها '",
284-
"description": "Instructions guiding the user through how to submit their logs to uProxy (part 2). This text is clickable and will open uProxy."
279+
"message": "برای ارسال سیاهههای مربوط خود را به تیم uProxy برای کمک، باز uProxy و بر روی \"ارسال بازخورد\"",
280+
"description": "Instructions guiding the user through how to submit their logs to uProxy."
285281
},
286282
"retrievingLogs": {
287283
"message": "بازیابی سیاهههای مربوط و تجزیه و تحلیل شبکه خود را ...",

src/generic_ui/locales/fr/messages.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,8 @@
276276
"description": "Title for the page that displays a user's network information and uProxy logs."
277277
},
278278
"toSendLogs": {
279-
"message": "Pour envoyer vos journaux à l'équipe uProxy de l'aide:",
280-
"description": "Instructions guiding the user through how to submit their logs to uProxy (part 1)."
281-
},
282-
"openFeedback": {
283-
"message": "ouvrir uProxy et cliquez sur «Soumettre Commentaires '",
284-
"description": "Instructions guiding the user through how to submit their logs to uProxy (part 2). This text is clickable and will open uProxy."
279+
"message": "Pour envoyer vos journaux à l'équipe uProxy de l'aide, ouvert uProxy et cliquez sur \"Envoyer des commentaires\"",
280+
"description": "Instructions guiding the user through how to submit their logs to uProxy."
285281
},
286282
"retrievingLogs": {
287283
"message": "Récupération des logs et d'analyser votre réseau ...",

src/generic_ui/polymer/feedback.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Polymer({
5454
});
5555
},
5656
viewLogs: function() {
57-
this.ui.openTab('generic_ui/view-logs.html');
57+
this.ui.openTab('generic_ui/view-logs.html?lang=' + model.globalSettings.language);
5858
},
5959
ready: function() {
6060
this.ui = ui_context.ui;

src/generic_ui/polymer/logs.html

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,11 @@
5252
</style>
5353

5454
<div id='container'>
55-
<h1>Logs & Network Analysis</h1>
56-
<p>To send your logs to the uProxy team for help:
57-
<span id='openUproxy' on-tap='{{ openUproxy }}'>open uProxy and click 'Submit Feedback'
58-
</span>
59-
</p>
55+
<h1><bdi>{{ 'logsTitle' | $$ }}</bdi></h1>
56+
<p><bdi>{{ 'toSendLogs' | $$ }}</bdi></p>
6057
<div id='logs'>
6158
<div id="loadingLogs" hidden?="{{ !loadingLogs }}">
62-
<p>Retrieving logs and analyzing your network...</p>
59+
<p>{{ 'retrievingLogs' | $$ }}</p>
6360
<paper-progress indeterminate='true'></paper-progress>
6461
</div>
6562
<pre>{{ logs }}</pre>

src/generic_ui/polymer/logs.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
1+
2+
import translator_module = require('../scripts/translator');
3+
4+
declare var PolymerExpressions: any;
5+
PolymerExpressions.prototype.$$ = translator_module.i18n_t;
6+
17
declare var bringUproxyToFront :() => void;
28
declare var getLogs :() => Promise<string>;
39

410
Polymer({
511
logs: '',
612
loadingLogs: true,
713
openUproxy: function() {
14+
// TODO: add a pop-out icon that calls this function.
815
bringUproxyToFront();
916
},
17+
created: function() {
18+
// Default language to English.
19+
var language = window.location.href.split('lang=')[1] || 'en';
20+
translator_module.i18n_setLng(language.substring(0,2));
21+
},
1022
ready: function() {
1123
// Expose global ui object in this context.
1224
getLogs().then((logs) => {

0 commit comments

Comments
 (0)