From 9a5c49d3fafc2a95258d1631ebeb5902d40dccfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 10 Oct 2018 17:11:17 -0400 Subject: [PATCH] closes #418 --- languages/en-GB/persona.json | 3 +++ languages/en-US/persona.json | 3 +++ lib/persona.js | 24 ++++++++++++++---------- plugin.json | 3 ++- 4 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 languages/en-GB/persona.json create mode 100644 languages/en-US/persona.json diff --git a/languages/en-GB/persona.json b/languages/en-GB/persona.json new file mode 100644 index 0000000..ffbe507 --- /dev/null +++ b/languages/en-GB/persona.json @@ -0,0 +1,3 @@ +{ + "mobile-menu-side": "Switch which side each mobile menu is on" +} \ No newline at end of file diff --git a/languages/en-US/persona.json b/languages/en-US/persona.json new file mode 100644 index 0000000..ffbe507 --- /dev/null +++ b/languages/en-US/persona.json @@ -0,0 +1,3 @@ +{ + "mobile-menu-side": "Switch which side each mobile menu is on" +} \ No newline at end of file diff --git a/lib/persona.js b/lib/persona.js index 80b57a1..a7f8cd6 100644 --- a/lib/persona.js +++ b/lib/persona.js @@ -268,17 +268,21 @@ $(document).ready(function() { function setupSetting() { if (ajaxify.data.template['account/settings'] && !document.getElementById('persona:menus:legacy-layout')) { - $('
') - .appendTo('#content .account > .row > div:first-child') - .find('input') - .prop('checked', Storage.getItem('persona:menus:legacy-layout', 'true')) - .change(function (e) { - if (e.target.checked) { - Storage.setItem('persona:menus:legacy-layout', 'true'); - } else { - Storage.removeItem('persona:menus:legacy-layout'); - } + require(['translator'], function (translator) { + translator.translate('[[persona:mobile-menu-side]]', function (translated) { + $('
') + .appendTo('#content .account > .row > div:first-child') + .find('input') + .prop('checked', Storage.getItem('persona:menus:legacy-layout', 'true')) + .change(function (e) { + if (e.target.checked) { + Storage.setItem('persona:menus:legacy-layout', 'true'); + } else { + Storage.removeItem('persona:menus:legacy-layout'); + } + }); }); + }) } } diff --git a/plugin.json b/plugin.json index d643683..d2ded57 100644 --- a/plugin.json +++ b/plugin.json @@ -21,5 +21,6 @@ }, "acpScripts": [ "lib/admin.js" - ] + ], + "languages": "languages" } \ No newline at end of file