From af269ea7569cc06aae092f3499a556b013fc40f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Tue, 11 Oct 2016 11:17:59 +0200 Subject: [PATCH 1/5] reorganizing text keys --- src/mods/land.js | 2 +- src/mods/text.js | 90 +++++++++++++++++++++++++----------------------- src/mods/tier.js | 4 +-- src/mods/ui.js | 59 +++++++++++++++---------------- 4 files changed, 79 insertions(+), 76 deletions(-) diff --git a/src/mods/land.js b/src/mods/land.js index b84dcc5..d9c26a1 100644 --- a/src/mods/land.js +++ b/src/mods/land.js @@ -75,7 +75,7 @@ idrinth.land = { } var results = baseCalculator ( getRequirements () ); if ( Object.keys ( results ).length === 0 ) { - idrinth.core.alert ( idrinth.text.get ( "land.lackGold" ) ); + idrinth.core.alert ( idrinth.text.get ( "land.lack" ) ); } putResults ( results ); }, diff --git a/src/mods/text.js b/src/mods/text.js index 0e6666b..ebfe02b 100644 --- a/src/mods/text.js +++ b/src/mods/text.js @@ -10,7 +10,7 @@ idrinth.text = { * @method start * @returns {undefined} */ - start: function () { + start: function ( ) { var language = idrinth.settings.language || window.navigator.userLanguage || window.navigator.language; if ( language === 'en' ) { idrinth.text.initialized = true; @@ -40,7 +40,7 @@ idrinth.text = { }, data: { chat: { - actions:{ + actions: { banUser: 'Ban User', makeMod: 'Make Moderator', makeAdmin: 'Make Admin', @@ -81,63 +81,65 @@ idrinth.text = { default: 'Unexpected error occurred. Please contact script developers' + ' (https://github.com/Idrinth/IDotD).', land: { - lackGold: 'You lack gold to buy any more buildings at the moment.' + lack: 'You lack gold to buy any more buildings at the moment.', + hour: ' gold per hour each', + calc: 'Calculate', + avaible: 'Avaible Gold' }, tier: { + search: 'Enter Boss\' Name', diff: { normal: 'Normal', hard: 'Hard', legend: 'Legend', night: 'Nightmare' }, - tagTop: 'Tag to screen-top', - maxBoxes: 'There is no space for another tier-box at the moment, please close one first.', - disableJoining: 'Disable joining for ' + tag: 'Tag to screen-top', + maxBoxes: 'There is no space for another tier-box at the moment, please close one first.' + }, + raids: { + lastJoined: 'Last raids joined:', + clear: 'Clear Raids', + disableJoining: 'Disable joining for ', + clickCopy: 'click to copy raid link', + imports: { + manually: 'Import all manually', + favs: 'Import favs manually', + restart: 'Restart Raidjoin' + } + }, + button: { + ok: 'Ok', + cancel: 'Cancel', + reloadGame: 'Reload game', + reloadScript: 'Reload Script', + refreshFBGameLogin: 'Refresh Facebook Game Login', + ngRaidJoin: 'NG Raid Join(slow!)', + disableTimedAutoJoin: 'disable timed Autojoin', + enableTimedAutoJoin: 'enable timed Autojoin' + }, + setting: { + enableExtCharInfo: 'Enable extended Characterinformation?', + minimLayout: 'Minimalist Layout', + moveSettingLeft: 'Move settings left', + warBottomPage: 'Show war at the bottom of the page', + useGoldEfficiently: 'Check to try and use up the gold as efficient as possible - uncheck to only use the most efficient buy in the land buy calculator', + tenBuildOnce: 'Buy 10 Buildings at once?(Rec)', + extCharInfoDuration: 'Milliseconds until the extended Characterinformation disappears', + joiningDuration: 'Seconds needed to load the game for joining', + enableChat: 'Enable chat(needs script reload)', + enableFavRequest: 'Enable Auto-Raid-Request for Favorites?', + favIdToJoin: 'FavoriteIds to join (separate multiple by comma)', + worldserver: 'Worldserver?', + disableAutoJoinSpecific: 'Disable Autojoining for specific raids' }, ui: { - button: { - ok: 'Ok', - cancel: 'Cancel', - reloadGame: 'Reload game', - clearRaids: 'Clear Raids', - reloadScript: 'Reload Script', - refreshFBGameLogin: 'Refresh Facebook Game Login', - ngRaidJoin: 'NG Raid Join(slow!)', - calc: 'Calculate', - disableTimedAutoJoin: 'disable timed Autojoin', - enableTimedAutoJoin: 'enable timed Autojoin' - }, - imports:{ - manually:'Import all manually', - favs:'Import favs manually', - restart:'Restart Raidjoin' - }, - lastRaidsJoined: 'Last raids joined:', - enterBossName: 'Enter Boss\' Name', settingInfo: 'This script will always import the raids you manually set to be imported on the website and if it\'s enabled it will also import all raids matched by one of the faved searches provided.', maxPopupsFrame: 'Maximum Popups/Frames for joining raids', timeAutoJoin: 'Time to automatically join raids slowly(reloads game multiple times). Format is [Hours]:[Minutes] without leading zeros, so 7:1 is fine, 07:01 is not', getFavFrom: 'Get your search-favorites from ', raidsearch: 'Idrinth\'s Raidsearch', - goldHour: ' gold per hour each', - availGold: 'Avaible Gold', - clickCopy: 'click to copy raid link', reloadGameFail: 'The game couldn\'t be reloaded', - setting: { - enableExtCharInfo: 'Enable extended Characterinformation?', - minimLayout: 'Minimalist Layout', - moveSettingLeft: 'Move settings left', - warBottomPage: 'Show war at the bottom of the page', - useGoldEfficiently: 'Check to try and use up the gold as efficient as possible - uncheck to only use the most efficient buy in the land buy calculator', - tenBuildOnce: 'Buy 10 Buildings at once?(Rec)', - extCharInfoDuration: 'Milliseconds until the extended Characterinformation disappears', - joiningDuration: 'Seconds needed to load the game for joining', - enableChat: 'Enable chat(needs script reload)', - enableFavRequest: 'Enable Auto-Raid-Request for Favorites?', - favIdToJoin: 'FavoriteIds to join (separate multiple by comma)', - worldserver: 'Worldserver?', - disableAutoJoinSpecific: 'Disable Autojoining for specific raids' - } } }, /** @@ -148,7 +150,7 @@ idrinth.text = { */ get: function ( key ) { var getSub = function ( obj, keys, func ) { - var key = keys.shift (); + var key = keys.shift ( ); if ( obj.hasOwnProperty ( key ) ) { if ( keys.length > 0 ) { return func ( obj[key], keys, func ); diff --git a/src/mods/tier.js b/src/mods/tier.js index 243c04c..b311017 100644 --- a/src/mods/tier.js +++ b/src/mods/tier.js @@ -101,7 +101,7 @@ idrinth.tier = { rType: '#input', type: 'checkbox', id: 'idrinth-raid-may-join-list-' + data[key].name, - label: idrinth.text.get ( "tier.disableJoining" ) + data[key].name + label: idrinth.text.get ( "raids.disableJoining" ) + data[key].name } ) ); document.getElementById ( 'idrinth-raid-may-join-list' ).lastChild.setAttribute ( 'style', 'background-image:url(https://dotd.idrinth.de/static/raid-image-service/' + data[key].url + '/);' ); @@ -185,7 +185,7 @@ idrinth.tier = { }, { type: 'button', - content: idrinth.text.get ( "tier.tagTop" ), + content: idrinth.text.get ( "tier.tag" ), attributes: [ { name: 'onclick', diff --git a/src/mods/ui.js b/src/mods/ui.js index fd764e2..f226b91 100644 --- a/src/mods/ui.js +++ b/src/mods/ui.js @@ -239,7 +239,7 @@ idrinth.ui = { var makeButton = function ( text, func ) { return { type: 'button', - content: idrinth.text.get ( "ui.button." + text ), + content: idrinth.text.get ( "button." + text ), attributes: [ { name: 'onclick', value: 'this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);' + func @@ -413,20 +413,21 @@ idrinth.ui = { }; return [ { children: [ - buttonMaker ( idrinth.text.get ( "ui.imports.manually" ), 'idrinth.raids.import(\'\');' ), - buttonMaker ( idrinth.text.get ( "ui.imports.favs" ), 'idrinth.raids.import(idrinth.settings.favs);' ), - buttonMaker ( idrinth.text.get ( "ui.button.reloadGame" ), 'idrinth.ui.reloadGame();' ), - buttonMaker ( idrinth.text.get ( "ui.button.clearRaids" ), 'idrinth.raids.clearAll();' ), - buttonMaker ( idrinth.text.get ( "ui.button.reloadScript" ), 'idrinth.reload();' ), - buttonMaker ( idrinth.text.get ( "ui.imports.restart" ), 'idrinth.raids.restartInterval();' ), - buttonMaker ( idrinth.text.get ( "ui.button.refreshFBGameLogin" ), 'idrinth.facebook.rejoin()', 'facebook' ), - buttonMaker ( idrinth.text.get ( "ui.button.ngRaidJoin" ), 'idrinth.newgrounds.joinRaids()', 'newgrounds' ), - buttonMaker ( idrinth.settings.alarmActive ? idrinth.text.get ( "ui.button.disableTimedAutoJoin" ) : idrinth.text.get ( "ui.button.enableTimedAutoJoin" ), 'idrinth.settings.change(\'alarmActive\',!idrinth.settings.alarmActive);this.innerHTML=idrinth.settings.alarmActive?\'disable timed Autojoin\':\'enable timed Autojoin\'', 'newgrounds' ) + buttonMaker ( idrinth.text.get ( "raids.imports.manually" ), 'idrinth.raids.import(\'\');' ), + buttonMaker ( idrinth.text.get ( "raids.imports.favs" ), 'idrinth.raids.import(idrinth.settings.favs);' ), + buttonMaker ( idrinth.text.get ( "button.reloadGame" ), 'idrinth.ui.reloadGame();' ), + buttonMaker ( idrinth.text.get ( "raids.clear" ), 'idrinth.raids.clearAll();' ), + buttonMaker ( idrinth.text.get ( "button.reloadScript" ), 'idrinth.reload();' ), + buttonMaker ( idrinth.text.get ( "raids.imports.restart" ), 'idrinth.raids.restartInterval();' ), + buttonMaker ( idrinth.text.get ( "button.refreshFBGameLogin" ), 'idrinth.facebook.rejoin()', 'facebook' ), + buttonMaker ( idrinth.text.get ( "button.ngRaidJoin" ), 'idrinth.newgrounds.joinRaids()', 'newgrounds' ), + buttonMaker ( idrinth.settings.alarmActive ? idrinth.text.get ( "button.disableTimedAutoJoin" ) : idrinth.text.get ( "button.enableTimedAutoJoin" ), + 'idrinth.settings.change(\'alarmActive\',!idrinth.settings.alarmActive);this.innerHTML=idrinth.settings.alarmActive?idrinth.text.get ( "button.disableTimedAutoJoin" ):"button.enableTimedAutoJoin"', 'newgrounds' ) ] }, { css: 'idrinth-line', id: 'idrinth-joined-raids', - content: idrinth.text.get ( "ui.lastRaidsJoined" ), + content: idrinth.text.get ( "raids.lastJoined" ), children: [ { type: 'ul' @@ -440,7 +441,7 @@ idrinth.ui = { css: 'idrinth-line', children: [ { type: 'label', - content: idrinth.text.get ( "ui.enterBossName" ), + content: idrinth.text.get ( "tier.search" ), css: 'idrinth-float-half', attributes: [ { @@ -470,49 +471,49 @@ idrinth.ui = { rType: '#input', type: 'checkbox', platforms: [ 'kongregate' ], - label: "ui.setting.enableExtCharInfo" + label: "setting.enableExtCharInfo" }, { name: 'minimalist', rType: '#input', type: 'checkbox', - label: "ui.setting.minimLayout" + label: "setting.minimLayout" }, { name: 'moveLeft', rType: '#input', type: 'checkbox', - label: "ui.setting.moveSettingLeft" + label: "setting.moveSettingLeft" }, { name: 'warBottom', rType: '#input', type: 'checkbox', - label: "ui.setting.warBottomPage" + label: "setting.warBottomPage" }, { name: 'landMax', rType: '#input', type: 'checkbox', - label: "ui.setting.useGoldEfficiently" + label: "setting.useGoldEfficiently" }, { name: 'factor', rType: '#input', type: 'checkbox', - label: "ui.setting.tenBuildOnce" + label: "setting.tenBuildOnce" }, { name: 'timeout', rType: '#input', type: 'number', platforms: [ 'kongregate' ], - label: "ui.setting.extCharInfoDuration" + label: "setting.extCharInfoDuration" }, { name: 'newgroundLoad', rType: '#input', type: 'number', platforms: [ 'newgrounds' ], - label: "ui.setting.joiningDuration" + label: "setting.joiningDuration" }, { name: 'chatting', rType: '#input', type: 'checkbox', - label: "ui.setting.enableChat" + label: "setting.enableChat" }, { css: 'idrinth-line', type: 'span', @@ -521,17 +522,17 @@ idrinth.ui = { name: 'raids', rType: '#input', type: 'checkbox', - label: "ui.setting.enableFavRequest" + label: "setting.enableFavRequest" }, { name: 'favs', rType: '#input', type: 'text', - label: "ui.setting.favIdToJoin" + label: "setting.favIdToJoin" }, { name: 'isWorldServer', rType: '#input', type: 'checkbox', - label: "ui.setting.worldserver" + label: "setting.worldserver" }, { name: 'notification#mention', rType: '#input', @@ -608,7 +609,7 @@ idrinth.ui = { attributes: [ { name: 'title', - value: idrinth.land.data[label.toLowerCase ()].perHour + idrinth.text.get ( "ui.goldHour" ) + value: idrinth.land.data[label.toLowerCase ()].perHour + idrinth.text.get ( "land.hour" ) } ] }; @@ -640,7 +641,7 @@ idrinth.ui = { type: 'tr', children: [ { type: 'th', - content: idrinth.text.get ( "ui.availGold" ) + content: idrinth.text.get ( "land.avaible" ) }, { type: 'td', children: [ { @@ -661,7 +662,7 @@ idrinth.ui = { type: 'td', children: [ { type: 'button', - content: idrinth.text.get ( "ui.button.calc" ), + content: idrinth.text.get ( "land.calc" ), attributes: [ { name: 'onclick', @@ -735,12 +736,12 @@ idrinth.ui = { }; var buildRaidJoinList = function () { return [ { - content: idrinth.text.get ( "ui.clickCopy" ), + content: idrinth.text.get ( "raids.clickCopy" ), type: 'strong' }, { id: 'idrinth-raid-link-list' }, { - content: idrinth.text.get ( "ui.setting.disableAutoJoinSpecific" ), + content: idrinth.text.get ( "setting.disableAutoJoinSpecific" ), type: 'strong' }, { id: 'idrinth-raid-may-join-list' From eeeced168ef20dde1578e55aefff84ffe25739f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Tue, 11 Oct 2016 12:59:38 +0200 Subject: [PATCH 2/5] reorganizing text keys providing default adding handling of ###LANG### to add defautl language --- languages/en.json | 2 - src/languages/en.json | 101 ++++++++++++++++++++++++++++++++++++++++ src/mods/chat.js | 26 +++++------ src/mods/text.js | 105 +----------------------------------------- src/mods/ui.js | 8 ++-- 5 files changed, 119 insertions(+), 123 deletions(-) delete mode 100644 languages/en.json create mode 100644 src/languages/en.json diff --git a/languages/en.json b/languages/en.json deleted file mode 100644 index 2c63c08..0000000 --- a/languages/en.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} diff --git a/src/languages/en.json b/src/languages/en.json new file mode 100644 index 0000000..1dcdb19 --- /dev/null +++ b/src/languages/en.json @@ -0,0 +1,101 @@ +{ + "chat": { + "actions": { + "banUser": "Ban User", + "makeMod": "Make Moderator", + "makeAdmin": "Make Admin", + "makeUser": "Make User", + "close": "Close", + "invite": "Invite to Chat ", + "createChat": "Create Chat", + "joinChat": "Join Chat", + "createAddChat": "Click to create additional chat", + "copyIdPasswort": "Copy Password&Id", + "deleteRoom": "Delete Room", + "leaveRoom": "Leave Room" + }, + "texts": { + "settings": "More settings at ", + "account": "Account", + "title": "Chat", + "creditEmoticon": "Emoticons provided by ", + "optional": "This part of the script is optional, so logging in is unneeded for raid catching etc.", + "invalid": "This should not be the data for logging in on the related gaming site and the login does not need to match your ingame name - you can set a display name after the registration.", + "offline": "Not logged in, click to login/register" + }, + "error": { + "modify": "Can't modify that user at the moment", + "create": "Can't create at the moment", + "join": "Joining didn't work", + "login": "Login failed in an unexpected way", + "unknown": "The given username for dotd.idrinth.de is unknown, do you want to register it there?" + }, + "notification": { + "mention": "chat-mention notifications?", + "raid": "chat-raid notifications?", + "message": "chat-message notifications?" + } + }, + "default": "Unexpected error occurred. Please contact script developers (https://github.com/Idrinth/IDotD).", + "land": { + "lack": "You lack gold to buy any more buildings at the moment.", + "hour": " gold per hour each", + "calc": "Calculate", + "avaible": "Avaible Gold" + }, + "tier": { + "search": "Enter Boss' Name", + "diff": { + "normal": "Normal", + "hard": "Hard", + "legend": "Legend", + "night": "Nightmare" + }, + "tag": "Tag to screen-top", + "maxBoxes": "There is no space for another tier-box at the moment, please close one first." + }, + "raids": { + "lastJoined": "Last raids joined", + "clear": "Clear Raids", + "disableJoining": "Disable joining for ", + "clickCopy": "click to copy raid link", + "imports": { + "manually": "Import all manually", + "favs": "Import favs manually", + "restart": "Restart Raidjoin" + }, + "disableSpecific": "Disable Autojoining for specific raids" + }, + "button": { + "ok": "Ok", + "cancel": "Cancel", + "reloadGame": "Reload game", + "reloadScript": "Reload Script", + "refreshFBGameLogin": "Refresh Facebook Game Login", + "ngRaidJoin": "NG Raid Join(slow!)", + "disableTimedAutoJoin": "disable timed Autojoin", + "enableTimedAutoJoin": "enable timed Autojoin" + }, + "setting": { + "enableExtCharInfo": "Enable extended Characterinformation?", + "minimLayout": "Minimalist Layout", + "moveSettingLeft": "Move settings left", + "warBottomPage": "Show war at the bottom of the page", + "useGoldEfficiently": "Check to try and use up the gold as efficient as possible - uncheck to only use the most efficient buy in the land buy calculator", + "tenBuildOnce": "Buy 10 Buildings at once?(Rec)", + "extCharInfoDuration": "Milliseconds until the extended Characterinformation disappears", + "joiningDuration": "Seconds needed to load the game for joining", + "enableChat": "Enable chat(needs script reload)", + "enableFavRequest": "Enable Auto-Raid-Request for Favorites?", + "favIdToJoin": "FavoriteIds to join (separate multiple by comma)", + "worldserver": "Worldserver?" + }, + "ui": { + "settingInfo": "This script will always import the raids you manually set to be imported on the website and if it's enabled it will also import all raids matched by one of the faved searches provided.", + "maxPopupsFrame": "Maximum Popups/Frames for joining raids", + "timeAutoJoin": "Time to automatically join raids slowly(reloads game multiple times). Format is [Hours]:[Minutes] without leading zeros, so 7:1 is fine, 07:01 is not", + "getFavFrom": "Get your search-favorites from ", + "raidsearch": "Idrinth's Raidsearch", + "reloadGameFail": "The game couldn't be reloaded" + } +} \ No newline at end of file diff --git a/src/mods/chat.js b/src/mods/chat.js index 18d72ae..a20cf84 100644 --- a/src/mods/chat.js +++ b/src/mods/chat.js @@ -586,7 +586,7 @@ idrinth.chat = { children: [ { type: 'h1', - content: idrinth.text.get ( "chat.ui.chat" ) + content: idrinth.text.get ( "chat.texts.title" ) }, { type: 'p', @@ -596,7 +596,7 @@ idrinth.chat = { children: [ { type: 'h2', - content: idrinth.text.get ( "chat.ui.account" ) + content: idrinth.text.get ( "chat.texts.account" ) }, { type: 'p', @@ -617,7 +617,7 @@ idrinth.chat = { children: [ { type: 'h2', - content: idrinth.text.get ( "chat.ui.joinChat" ) + content: idrinth.text.get ( "chat.actions.joinChat" ) }, { type: 'ul', @@ -625,7 +625,7 @@ idrinth.chat = { children: [ makeInput ( 'Chat-ID' ), makeInput ( 'Chat-Password' ), - makeButton ( 'chat.ui.createAddChat', "idrinth.chat.add()" ) + makeButton ( 'chat.actions.createAddChat', "idrinth.chat.add()" ) ] } ] @@ -635,14 +635,14 @@ idrinth.chat = { children: [ { type: 'h2', - content: idrinth.text.get ( "chat.ui.createChat" ) + content: idrinth.text.get ( "chat.actions.createChat" ) }, { type: 'ul', css: 'settings', children: [ makeInput ( "Name" ), - makeButton ( 'chat.ui.createAddChat', "idrinth.chat.create()" ) + makeButton ( 'chat.actions.createAddChat', "idrinth.chat.create()" ) ] } ] @@ -651,7 +651,7 @@ idrinth.chat = { children: [ { type: '#text', - content: idrinth.text.get ( "chat.ui.moreSettings" ) + content: idrinth.text.get ( "chat.text.settings" ) }, { type: 'a', @@ -677,7 +677,7 @@ idrinth.chat = { children: [ { type: '#text', - content: idrinth.text.get ( "chat.ui.creditEmoticon" ) + content: idrinth.text.get ( "chat.creditEmoticon" ) }, { type: 'a', @@ -839,7 +839,7 @@ idrinth.chat = { return; } if ( !data.success && data.message && data['allow-reg'] ) { - idrinth.core.confirm ( idrinth.text.get ( "chat.message.unknown" ), 'idrinth.chat.register();' ); + idrinth.core.confirm ( idrinth.text.get ( "chat.error.unknown" ), 'idrinth.chat.register();' ); return; } if ( !data.success && data.message ) { @@ -872,21 +872,21 @@ idrinth.chat = { css: 'idrinth-hovering-box', children: [ { css: 'clipboard-copy', - content: idrinth.text.get ( "chat.ui.copyIdPasswort" ), + content: idrinth.text.get ( "chat.actions.copyIdPasswort" ), type: 'li', attributes: [ { name: 'data-clipboard-text', value: element.getAttribute ( 'title' ) } ] }, { - content: idrinth.text.get ( "chat.ui.leaveRoom" ), + content: idrinth.text.get ( "chat.actions.leaveRoom" ), type: 'li', attributes: [ { name: 'onclick', value: 'idrinth.chat.useroptions(' + element.getAttribute ( 'data-id' ) + ',' + idrinth.chat.self + ',\'Leave\');this.parentNode.parentNode.removeChild(this.parentNode);' } ] }, { - content: idrinth.text.get ( "chat.ui.deleteRoom" ), + content: idrinth.text.get ( "chat.actions.deleteRoom" ), type: 'li', attributes: [ { name: 'onclick', @@ -894,7 +894,7 @@ idrinth.chat = { } ] }, { type: 'li', - content: idrinth.text.get ( "chat.ui.close" ), + content: idrinth.text.get ( "chat.actions.close" ), attributes: [ { name: 'onclick', value: 'this.parentNode.parentNode.removeChild(this.parentNode);' diff --git a/src/mods/text.js b/src/mods/text.js index ebfe02b..55e1b07 100644 --- a/src/mods/text.js +++ b/src/mods/text.js @@ -38,110 +38,7 @@ idrinth.text = { applyRecursive ( idrinth.text.data, JSON.parse ( file ), applyRecursive ); }, idrinth.text.start, idrinth.text.start, null, true ); }, - data: { - chat: { - actions: { - banUser: 'Ban User', - makeMod: 'Make Moderator', - makeAdmin: 'Make Admin', - makeUser: 'Make User' - }, - ui: { - close: 'Close', - invite: 'Invite to Chat ', - account: 'Account', - chat: 'Chat', - createChat: 'Create Chat', - joinChat: 'Join Chat', - createAddChat: "Click to create additional chat", - creditEmoticon: 'Emoticons provided by ', - copyIdPasswort: 'Copy Password&Id', - moreSettings: 'More settings at ', - deleteRoom: 'Delete Room', - leaveRoom: 'Leave Room' - }, - message: { - optional: 'This part of the script is optional, so logging in is unneeded for raid catching etc.', - invalid: 'This should not be the data for logging in on the related gaming site and the login does not need to match your ingame name - you can set a display name after the registration.', - offline: "Not logged in, click to login/register", - unknown: 'The given username for dotd.idrinth.de is unknown, do you want to register it there?' - }, - error: { - modify: 'Can\'t modify that user at the moment', - create: 'Can\'t create at the moment', - join: 'Joining didn\'t work', - login: 'Login failed in an unexpected way' - }, - notification: { - mentionNotis: 'chat-mention notifications?', - raidNotis: 'chat-raid notifications?', - messageNotis: 'chat-message notifications?' - } - }, - default: 'Unexpected error occurred. Please contact script developers' - + ' (https://github.com/Idrinth/IDotD).', - land: { - lack: 'You lack gold to buy any more buildings at the moment.', - hour: ' gold per hour each', - calc: 'Calculate', - avaible: 'Avaible Gold' - }, - tier: { - search: 'Enter Boss\' Name', - diff: { - normal: 'Normal', - hard: 'Hard', - legend: 'Legend', - night: 'Nightmare' - }, - tag: 'Tag to screen-top', - maxBoxes: 'There is no space for another tier-box at the moment, please close one first.' - }, - raids: { - lastJoined: 'Last raids joined:', - clear: 'Clear Raids', - disableJoining: 'Disable joining for ', - clickCopy: 'click to copy raid link', - imports: { - manually: 'Import all manually', - favs: 'Import favs manually', - restart: 'Restart Raidjoin' - } - }, - button: { - ok: 'Ok', - cancel: 'Cancel', - reloadGame: 'Reload game', - reloadScript: 'Reload Script', - refreshFBGameLogin: 'Refresh Facebook Game Login', - ngRaidJoin: 'NG Raid Join(slow!)', - disableTimedAutoJoin: 'disable timed Autojoin', - enableTimedAutoJoin: 'enable timed Autojoin' - }, - setting: { - enableExtCharInfo: 'Enable extended Characterinformation?', - minimLayout: 'Minimalist Layout', - moveSettingLeft: 'Move settings left', - warBottomPage: 'Show war at the bottom of the page', - useGoldEfficiently: 'Check to try and use up the gold as efficient as possible - uncheck to only use the most efficient buy in the land buy calculator', - tenBuildOnce: 'Buy 10 Buildings at once?(Rec)', - extCharInfoDuration: 'Milliseconds until the extended Characterinformation disappears', - joiningDuration: 'Seconds needed to load the game for joining', - enableChat: 'Enable chat(needs script reload)', - enableFavRequest: 'Enable Auto-Raid-Request for Favorites?', - favIdToJoin: 'FavoriteIds to join (separate multiple by comma)', - worldserver: 'Worldserver?', - disableAutoJoinSpecific: 'Disable Autojoining for specific raids' - }, - ui: { - settingInfo: 'This script will always import the raids you manually set to be imported on the website and if it\'s enabled it will also import all raids matched by one of the faved searches provided.', - maxPopupsFrame: 'Maximum Popups/Frames for joining raids', - timeAutoJoin: 'Time to automatically join raids slowly(reloads game multiple times). Format is [Hours]:[Minutes] without leading zeros, so 7:1 is fine, 07:01 is not', - getFavFrom: 'Get your search-favorites from ', - raidsearch: 'Idrinth\'s Raidsearch', - reloadGameFail: 'The game couldn\'t be reloaded', - } - }, + data: JSON.parse ( '###LANG###' ), /** * returns the translation of a provided key or an error-message if no * matching translation is found diff --git a/src/mods/ui.js b/src/mods/ui.js index f226b91..02e9b43 100644 --- a/src/mods/ui.js +++ b/src/mods/ui.js @@ -537,17 +537,17 @@ idrinth.ui = { name: 'notification#mention', rType: '#input', type: 'checkbox', - label: 'chat.notification.mentionNotis' + label: 'chat.notification.mention' }, { name: 'notification#raid', rType: '#input', type: 'checkbox', - label: 'chat.notification.raidNotis' + label: 'chat.notification.raid' }, { name: 'notification#message', rType: '#input', type: 'checkbox', - label: 'chat.notification.messageNotis' + label: 'chat.notification.message' }, { name: 'windows', rType: '#input', @@ -741,7 +741,7 @@ idrinth.ui = { }, { id: 'idrinth-raid-link-list' }, { - content: idrinth.text.get ( "setting.disableAutoJoinSpecific" ), + content: idrinth.text.get ( "raids.disableSpecific" ), type: 'strong' }, { id: 'idrinth-raid-may-join-list' From 5c4e72b2b9274c260644a4df21fceb0a73003c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Tue, 11 Oct 2016 13:12:30 +0200 Subject: [PATCH 3/5] some headers added for #135 fixes #199 --- src/mods/text.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mods/text.js b/src/mods/text.js index 55e1b07..f71adc8 100644 --- a/src/mods/text.js +++ b/src/mods/text.js @@ -7,7 +7,6 @@ idrinth.text = { /** * Loads language specific code and signals it's readyness by setting * idrinth.text.initialized to true - * @method start * @returns {undefined} */ start: function ( ) { @@ -38,6 +37,10 @@ idrinth.text = { applyRecursive ( idrinth.text.data, JSON.parse ( file ), applyRecursive ); }, idrinth.text.start, idrinth.text.start, null, true ); }, + /** + * See languages/en.json for an example + * @type {object} + */ data: JSON.parse ( '###LANG###' ), /** * returns the translation of a provided key or an error-message if no From 0c1c97934e9efdd6732cad124750424d478a7f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Tue, 11 Oct 2016 13:35:10 +0200 Subject: [PATCH 4/5] adding some missing headers correcting url for language retrieval adding setting for language --- src/mods/settings.js | 1 + src/mods/text.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mods/settings.js b/src/mods/settings.js index ad3ee84..f01d641 100644 --- a/src/mods/settings.js +++ b/src/mods/settings.js @@ -19,6 +19,7 @@ idrinth.settings = { alarmTime: '8:0', alarmActive: false, bannedRaids: { }, + language: 'en', notification: { mention: true, message: true, diff --git a/src/mods/text.js b/src/mods/text.js index f71adc8..9f77f1b 100644 --- a/src/mods/text.js +++ b/src/mods/text.js @@ -15,7 +15,7 @@ idrinth.text = { idrinth.text.initialized = true; return; } - idrinth.core.ajax.runHome ( '', function ( file ) { + idrinth.core.ajax.runHome ( 'lang-service/', function ( file ) { /** * * @param {object} to @@ -49,6 +49,13 @@ idrinth.text = { * @returns {string} */ get: function ( key ) { + /** + * + * @param {object} obj + * @param {Array} keys + * @param {function} func + * @returns {string} + */ var getSub = function ( obj, keys, func ) { var key = keys.shift ( ); if ( obj.hasOwnProperty ( key ) ) { From 5e16bf7338530396cc548aa5a1f975d3bb3d4c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=BCttner?= Date: Tue, 11 Oct 2016 13:36:45 +0200 Subject: [PATCH 5/5] adding support for branches --- src/mods/text.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mods/text.js b/src/mods/text.js index 9f77f1b..7fbd3cb 100644 --- a/src/mods/text.js +++ b/src/mods/text.js @@ -15,7 +15,7 @@ idrinth.text = { idrinth.text.initialized = true; return; } - idrinth.core.ajax.runHome ( 'lang-service/', function ( file ) { + idrinth.core.ajax.runHome ( 'lang-service/###RELOAD-VERSION###/', function ( file ) { /** * * @param {object} to