diff --git a/src/commandRenamer.js b/src/commandRenamer.js index 19e6f20..f7a51d0 100644 --- a/src/commandRenamer.js +++ b/src/commandRenamer.js @@ -1,3 +1,4 @@ +import getTranslations from './i18n/commandRenamer'; import wait from './utils/wait'; // ==UserScript== @@ -5,13 +6,15 @@ import wait from './utils/wait'; // @namespace https://github.com/tribalwarshelp/scripts // @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/commandRenamer.js // @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/commandRenamer.js -// @version 0.4.2 +// @version 0.2.0 // @description Command renamer // @author Kichiyaki http://dawid-wysokinski.pl/ // @match *://*/game.php*mode=incomings* // @grant none // ==/UserScript== +const translations = getTranslations(); + const handleSubmit = async (e) => { e.preventDefault(); const name = e.target[0].value; @@ -38,8 +41,8 @@ const handleSubmit = async (e) => { const renderUI = () => { const html = ` - - + + `; const form = document.createElement('form'); diff --git a/src/i18n/commandRenamer.js b/src/i18n/commandRenamer.js new file mode 100644 index 0000000..4a3ae5e --- /dev/null +++ b/src/i18n/commandRenamer.js @@ -0,0 +1,13 @@ +const translations = { + pl_PL: { + rename: 'ZmieƄ', + name: 'Nazwa', + }, + en_DK: { + rename: 'Rename', + name: 'Name', + }, +}; + +export default () => + translations[window.game_data.locale] || translations.en_DK;