Skip to content

Commit 2b366dc

Browse files
committed
Fix Translations (OSX)
1 parent d171cc3 commit 2b366dc

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

src/hotkeys.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,11 @@ <h2 class="i18n">Developers</h2>
205205
if (!localStorage.appLang) localStorage.appLang = 'template';
206206
if (['template','English'].indexOf(localStorage.appLang) > -1) newLang = 'template';
207207
else newLang = localStorage.appLang;
208-
translator.changeLocal(require('path').dirname(process.execPath)+'/src/locale/' + newLang.split(' ').join('_'));
208+
if (process.platform == 'darwin') {
209+
translator.changeLocal('./locale/' + newLang.split(' ').join('_'));
210+
} else {
211+
translator.changeLocal(require('path').dirname(process.execPath)+'/src/locale/' + newLang.split(' ').join('_'));
212+
}
209213
var i18n = translator.i18n;
210214
document.title = i18n(document.title);
211215
</script>

src/lib/ui.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,13 @@ function refreshMainBut() {
787787
}
788788
}
789789

790-
require('fs').readdir(require('path').dirname(process.execPath)+'/src/locale', function(err, files) {
790+
if (process.platform == 'darwin') {
791+
var localePath = './src/locale';
792+
} else {
793+
var localePath = require('path').dirname(process.execPath)+'/src/locale';
794+
}
795+
796+
require('fs').readdir(localePath, function(err, files) {
791797
var langOptions = '<option class="i18n">' + i18n('English') + '</option>';
792798
langOptions += files.map(function(el) {
793799
return el != 'template.js' ? '<option value="' + el.replace('.js', '').split('_').join(' ') + '">' + translator.langName(el.replace('.js', '').split('_').join(' ')) + '</option>' : '';
@@ -801,7 +807,11 @@ $("#change-lang").on('change', function() {
801807
} else {
802808
localStorage.appLang = $(this).val();
803809
}
804-
translator.changeLocal(require('path').dirname(process.execPath)+'/src/locale/' + localStorage.appLang.split(' ').join('_'));
810+
if (process.platform == 'darwin') {
811+
translator.changeLocal('./locale/' + localStorage.appLang.split(' ').join('_'));
812+
} else {
813+
translator.changeLocal(require('path').dirname(process.execPath)+'/src/locale/' + localStorage.appLang.split(' ').join('_'));
814+
}
805815
setTimeout(function() {
806816
refreshMainBut();
807817
},0);

src/mask.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333
if (!localStorage.appLang) localStorage.appLang = 'template';
3434
if (['template','English'].indexOf(localStorage.appLang) > -1) newLang = 'template';
3535
else newLang = localStorage.appLang;
36-
translator.setLocal(require('path').dirname(process.execPath)+'/src/locale/' + newLang.split(' ').join('_'));
36+
if (process.platform == 'darwin') {
37+
translator.setLocal('./locale/' + newLang.split(' ').join('_'));
38+
} else {
39+
translator.setLocal(require('path').dirname(process.execPath)+'/src/locale/' + newLang.split(' ').join('_'));
40+
}
3741
var i18n = translator.i18n;
3842
</script>
3943
<script src="lib/defaults.js"></script>

src/updater.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
if (!localStorage.appLang) localStorage.appLang = 'template';
1515
if (['template','English'].indexOf(localStorage.appLang) > -1) newLang = 'template';
1616
else newLang = localStorage.appLang;
17-
translator.setLocal(require('path').dirname(process.execPath)+'/src/locale/' + newLang.split(' ').join('_'));
17+
if (process.platform == 'darwin') {
18+
translator.setLocal('./locale/' + newLang.split(' ').join('_'));
19+
} else {
20+
translator.setLocal(require('path').dirname(process.execPath)+'/src/locale/' + newLang.split(' ').join('_'));
21+
}
1822
var i18n = translator.i18n;
1923
document.title = i18n(document.title);
2024
</script>

0 commit comments

Comments
 (0)