diff --git a/index.html b/index.html index 4e72a73..8b8aee0 100644 --- a/index.html +++ b/index.html @@ -14,10 +14,10 @@ - + - + @@ -97,15 +97,15 @@
- + - + - + - + - +
@@ -319,8 +319,13 @@
Some text some message...
+ + + + + diff --git a/js/scripts.js b/js/scripts.js index 2a8e58e..242a2f2 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -346,7 +346,3 @@ const update = function () { calculateOutput(prices, first_buy, previous_pattern); } - -$(document).ready(initialize); -$(document).on("input", update); -$('input[type = radio]').on("change", update); diff --git a/js/translations.js b/js/translations.js new file mode 100644 index 0000000..66479bd --- /dev/null +++ b/js/translations.js @@ -0,0 +1,25 @@ +function updateContent() { + update(); + $("body").localize(); +} + +i18next + .use(i18nextXHRBackend) + .use(i18nextBrowserLanguageDetector) + .init({ + fallbackLng: 'en', + debug: true, + backend: { + loadPath: 'locales/{{lng}}.json', + }, + }, function(err, t) { + jqueryI18next.init(i18next, $); + i18next.on('languageChanged', () => { + updateContent(); + }); + + // init set content + $(document).ready(initialize); + $(document).on("input", updateContent); + $('input[type = radio]').on("change", updateContent); + }); diff --git a/locales/en.json b/locales/en.json new file mode 100644 index 0000000..3304359 --- /dev/null +++ b/locales/en.json @@ -0,0 +1,9 @@ +{ + "patterns": { + "decreasing": "Decreasing", + "fluctuating": "Fluctuating", + "unknown": "I don't know", + "large-spike": "Large Spike", + "small-spike": "Small Spike" + } +}