Added i18n keys to source code

master
Marcel Deglau 4 years ago
parent af8cbe5778
commit 2ba5ce0185

@ -45,17 +45,14 @@
<body>
<div class="dialog-box">
<h2 class="dialog-box__name">Daisy Mae</h2>
<p>Hello, and welcome to the <b>Turnip Prophet</b> app on your Nook Phone.</p>
<p>This app lets you track your island's turnip prices daily, but you'll have to put the prices in yourself!
</p>
<p>After that, the Turnip Prophet app will <b>magically</b> predict the turnip prices you'll have for the rest of
the week.
</p>
<h2 class="dialog-box__name" data-i18n="general.daisymae"></h2>
<p data-i18n="[html]welcome.salutation"></p>
<p data-i18n="welcome.description"></p>
<p data-i18n="[html]welcome.conclusion"></p>
</div>
<div class="nook-phone">
<h1>Turnip Prophet</h1>
<h1 data-i18n="general.name"></h1>
<div>
<svg class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
@ -78,23 +75,22 @@
<form class="input__form">
<div class="form__row">
<h6>First-Time Buyer</h6>
<h6 data-i18n="firsttime.title"></h6>
<div class="input__group">
<label>Is this your first time buying turnips from Daisy Mae on your island?<i>(This affects your
pattern)</i></label>
<label data-i18n="[html]firsttime.description"></label>
<div class="input__radio-buttons">
<input type="radio" id="first-time-radio-no" name="first-time" value="false" checked>
<label for="first-time-radio-no">No</label>
<label for="first-time-radio-no" data-i18n="firsttime.no"></label>
<input type="radio" id="first-time-radio-yes" name="first-time" value="true">
<label for="first-time-radio-yes">Yes</label>
<label for="first-time-radio-yes" data-i18n="firsttime.yes"></label>
</div>
</div>
</div>
<div class="form__row">
<h6>Previous Pattern</h6>
<h6 data-i18n="patterns.title"></h6>
<div class="input__group">
<label for="">What was last week's turnip price pattern?<i>(This affects your pattern)</i></label>
<label for="" data-i18n="[html]patterns.description"></label>
<div class="input__radio-buttons">
<input type="radio" id="pattern-radio-unknown" name="pattern" value="-1" checked>
<label data-i18n="patterns.unknown" for="pattern-radio-unknown"></label>
@ -111,19 +107,18 @@
</div>
<div class="form__row">
<h6>Sunday</h6>
<h6 data-i18n="weekdays.sunday"></h6>
<div class="input__group">
<label>What was the price of turnips this week on your island? <i>(If this is your first time buying turnips, this field
will be disabled)</i></label>
<label data-i18n="[html]prices.description"></label>
<input type="number" id="buy" placeholder="..." />
</div>
</div>
<i>AM - 8:00 am to 11:59 am</i>
<i>PM - 12:00 pm to 10:00 pm</i>
<i data-i18n="prices.open.am"></i>
<i data-i18n="prices.open.am"></i>
<div class="form__flex-wrap">
<div class="form__row">
<h6>Monday</h6>
<h6 data-i18n="weekdays.monday"></h6>
<div class="input__group">
<label data-i18n="times.morning" for="sell_2"></label>
<input type="number" id="sell_2" placeholder="..." />
@ -135,7 +130,7 @@
</div>
<div class="form__row">
<h6>Tuesday</h6>
<h6 data-i18n="weekdays.tuesday"></h6>
<div class="input__group">
<label data-i18n="times.morning" for="sell_4"></label>
<input type="number" id="sell_4" placeholder="..." />
@ -147,7 +142,7 @@
</div>
<div class="form__row">
<h6>Wednesday</h6>
<h6 data-i18n="weekdays.wednesday"></h6>
<div class="input__group">
<label data-i18n="times.morning" for="sell_6"></label>
<input type="number" id="sell_6" placeholder="..." />
@ -159,7 +154,7 @@
</div>
<div class="form__row">
<h6>Thursday</h6>
<h6 data-i18n="weekdays.thursday"></h6>
<div class="input__group">
<label data-i18n="times.morning" for="sell_8"></label>
<input type="number" id="sell_8" placeholder="..." />
@ -171,7 +166,7 @@
</div>
<div class="form__row">
<h6>Friday</h6>
<h6 data-i18n="weekdays.friday"></h6>
<div class="input__group">
<label data-i18n="times.morning" for="sell_10"></label>
<input type="number" id="sell_10" placeholder="..." />
@ -183,7 +178,7 @@
</div>
<div class="form__row">
<h6>Saturday</h6>
<h6 data-i18n="weekdays.saturday"></h6>
<div class="input__group">
<label data-i18n="times.morning" for="sell_12"></label>
<input type="number" id="sell_12" placeholder="..." />
@ -196,19 +191,17 @@
</div>
<input id="permalink-input" type="text" />
<div id="permalink-btn" class="button permalink">
<span>Copy permalink</span>
<span data-i18n="prices.copy-permalink"></span>
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="copy" class="svg-inline--fa fa-copy fa-w-14" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<path fill="currentColor" d="M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z"></path>
</svg>
</div>
<button type="button" id="reset" class="button button--reset" name="action">
Reset Turnip Prophet
</button>
<button type="button" id="reset" class="button button--reset" name="action" data-i18n="prices.reset"></button>
</form>
<h2>Output</h2>
<h2 data-i18n="output.title"></h2>
<div class="chart-wrapper">
<canvas id="chart" width="100%" height="100"></canvas>
@ -218,18 +211,18 @@
<table id="turnipTable">
<thead>
<tr>
<th valign="bottom">Pattern</th>
<th valign="bottom">% Chance</th>
<th valign="bottom">Sunday</th>
<th valign="bottom" data-i18n="patterns.pattern"></th>
<th valign="bottom" data-i18n="output.chance"></th>
<th valign="bottom" data-i18n="weekdays.sunday"></th>
<th colspan="2">
<div>Monday</div>
<div data-i18n="weekdays.monday"></div>
<div>
<span data-i18n="times.morning"></span>
<span data-i18n="times.afternoon"></span>
</div>
</th>
<th colspan="2">
<div>Tuesday</div>
<div data-i18n="weekdays.tuesday"></div>
<div>
<span data-i18n="times.morning"></span>
<span data-i18n="times.afternoon"></span>
@ -237,7 +230,7 @@
</th>
<th colspan="2">
<div>
<div>Wednesday</div>
<div data-i18n="weekdays.wednesday"></div>
<div>
<span data-i18n="times.morning"></span>
<span data-i18n="times.afternoon"></span>
@ -245,28 +238,28 @@
</div>
</th>
<th colspan="2">
<div>Thursday</div>
<div data-i18n="weekdays.thursday"></div>
<div>
<span data-i18n="times.morning"></span>
<span data-i18n="times.afternoon"></span>
</div>
</th>
<th colspan="2">
<div>Friday</div>
<div data-i18n="weekdays.friday"></div>
<div>
<span data-i18n="times.morning"></span>
<span data-i18n="times.afternoon"></span>
</div>
</th>
<th colspan="2">
<div>Saturday</div>
<div data-i18n="weekdays.saturday"></div>
<div>
<span data-i18n="times.morning"></span>
<span data-i18n="times.afternoon"></span>
</div>
</th>
<th valign="bottom">Guaranteed Minimum</th>
<th valign="bottom">Potential Maximum</th>
<th valign="bottom" data-i18n="output.minimum"></th>
<th valign="bottom" data-i18n="output.maximum"></th>
</tr>
</thead>
<tbody id="output"></tbody>
@ -293,24 +286,16 @@
</div>
<div class="dialog-box">
<h2 class="dialog-box__name">Daisy Mae</h2>
<p>After you've listed some turnip prices, the Turnip Prophet will run some numbers and display the different
possible patterns that your island may experience.</p>
<p>This app is still in development, but will improve over time!</p>
<h2 class="dialog-box__name" data-i18n="general.daisymae"></h2>
<p data-i18n="textbox.description"></p>
<p data-i18n="textbox.development"></p>
</div>
<div class="dialog-box">
<h2 class="dialog-box__name">Daisy Mae</h2>
<p>
None of this would have been possible without <a
href="https://twitter.com/_Ninji/status/1244818665851289602?s=20">Ninji's work</a> figuring out just how Timmy
and Tommy value their turnips.
</p>
<p>
Support, comments and contributions are available through <a
href="https://github.com/mikebryant/ac-nh-turnip-prices/issues">Github</a>
</p>
<p>Oh! And let's not forget to thank those who have contributed so far!</p>
<h2 class="dialog-box__name" data-i18n="general.daisymae"></h2>
<p data-i18n="[html]textbox.thanks"></p>
<p data-i18n="[html]textbox.support"></p>
<p data-i18n="textbox.contributors-text"></p>
<p id="contributors">
Contributors:
</p>

@ -22,17 +22,17 @@ function update_chart(input_data, possibilities) {
datasets = [
{
label: "Input Price",
label: i18next.t("output.chart.input"),
data: input_data.slice(1),
fill: false,
},
{
label: "Minimum",
label: i18next.t("output.chart.minimum"),
data: possibilities[0].prices.slice(1).map(day => day.min),
fill: false,
},
{
label: "Maximum",
label: i18next.t("output.chart.maximum"),
data: possibilities[0].prices.slice(1).map(day => day.max),
fill: "-1",
},
@ -45,7 +45,7 @@ function update_chart(input_data, possibilities) {
chart_instance = new Chart(ctx, {
data: {
datasets: datasets,
labels: ["Sunday", "Mon AM", "Mon PM", "Tue AM", "Tue PM", "Wed AM", "Wed PM", "Thu AM", "Thu PM", "Fri AM", "Fri PM", "Sat AM", "Sat PM"],
labels: [i18next.t("weekdays.sunday"), i18next.t("weekdays.abr.monday") + i18next.t("times.morning"), i18next.t("weekdays.abr.monday") + i18next.t("times.afternoon"), i18next.t("weekdays.abr.tuesday") + i18next.t("times.morning"), i18next.t("weekdays.abr.tuesday") + i18next.t("times.afternoon"), i18next.t("weekdays.abr.wednesday") + i18next.t("times.morning"), i18next.t("weekdays.abr.wednesday") + i18next.t("times.afternoon"), i18next.t("weekdays.abr.thursday") + i18next.t("times.morning"), i18next.t("weekdays.abr.thursday") + i18next.t("times.afternoon"), i18next.t("weekdays.abr.friday") + i18next.t("times.morning"), i18next.t("weekdays.abr.friday") + i18next.t("times.afternoon"), i18next.t("weekdays.abr.saturday") + i18next.t("times.morning"), i18next.t("weekdays.abr.saturday") + i18next.t("times.afternoon")],
},
options: chart_options,
type: "line",

@ -560,7 +560,7 @@ function*
}
yield {
pattern_description: "Fluctuating",
pattern_description: i18next.t("patterns.fluctuating"),
pattern_number: 0,
prices: predicted_prices,
probability,
@ -639,7 +639,7 @@ function* generate_pattern_1_with_peak(given_prices, peak_start) {
}
}
yield {
pattern_description: "Large spike",
pattern_description: i18next.t("patterns.large-spike"),
pattern_number: 1,
prices: predicted_prices,
probability,
@ -686,7 +686,7 @@ function* generate_pattern_2(given_prices) {
}
yield {
pattern_description: "Decreasing",
pattern_description: i18next.t("patterns.decreasing"),
pattern_number: 2,
prices: predicted_prices,
probability,
@ -767,7 +767,7 @@ function* generate_pattern_3_with_peak(given_prices, peak_start) {
}
yield {
pattern_description: "Small spike",
pattern_description: i18next.t("patterns.small-spike"),
pattern_number: 3,
prices: predicted_prices,
probability,
@ -863,7 +863,7 @@ function analyze_possibilities(sell_prices, first_buy, previous_pattern) {
}
generated_possibilities.unshift({
pattern_description: "All patterns",
pattern_description: i18next.t("patterns.all"),
pattern_number: 4,
prices: global_min_max,
weekGuaranteedMinimum: Math.min(...generated_possibilities.map(poss => poss.weekGuaranteedMinimum)),

@ -85,7 +85,7 @@ const initialize = function () {
$("#permalink-btn").on("click", copyPermalink)
$("#reset").on("click", function () {
if (window.confirm("Are you sure you want to reset all fields?\n\nThis cannot be undone!")) {
if (window.confirm(i18next.t("prices.reset-warning"))) {
sell_inputs.forEach(input => input.value = '')
fillFields([], false, -1)
update()
@ -260,7 +260,7 @@ const calculateOutput = function (data, first_buy, previous_pattern) {
out_line += `<td>${Number.isFinite(poss.probability) ? ((poss.probability * 100).toPrecision(3) + '%') : '—'}</td>`;
for (let day of poss.prices.slice(1)) {
if (day.min !== day.max) {
out_line += `<td>${day.min} to ${day.max}</td>`;
out_line += `<td>${day.min} ${i18next.t("output.to")} ${day.max}</td>`;
} else {
out_line += `<td>${day.min}</td>`;
}
@ -308,7 +308,7 @@ const copyPermalink = function () {
document.execCommand('copy');
permalink_input.hide();
flashMessage("Permalink copied!");
flashMessage(i18next.t("prices.permalink-copied"));
}
const flashMessage = function(message) {

@ -1,13 +1,80 @@
{
"general": {
"name": "Turnip Prophet",
"daisymae": "Daisy Mae"
},
"welcome": {
"salutation": "Hello, and welcome to the <b>Turnip Prophet</b> app on your Nook Phone.",
"description": "This app lets you track your island's turnip prices daily, but you'll have to put the prices in yourself!",
"conclusion": "After that, the Turnip Prophet app will <b>magically</b> predict the turnip prices you'll have for the rest of the week."
},
"firsttime": {
"title": "First-Time Buyer",
"description": "Is this your first time buying turnips from Daisy Mae on your island?<i>(This affects your pattern)</i>",
"yes": "Yes",
"no": "No"
},
"patterns": {
"title": "Previous Pattern",
"description": "What was last week's turnip price pattern?<i>(This affects your pattern)</i>",
"pattern": "Pattern",
"all": "All patterns",
"decreasing": "Decreasing",
"fluctuating": "Fluctuating",
"unknown": "I don't know",
"large-spike": "Large Spike",
"small-spike": "Small Spike"
},
"prices": {
"description": "What was the price of turnips this week on your island? <i>(If this is your first time buying turnips, this field will be disabled)</i>",
"open": {
"am": "AM - 8:00 am to 11:59 am",
"pm": "PM - 12:00 pm to 10:00 pm"
},
"copy-permalink": "Copy permalink",
"permalink-copied": "Permalink copied!",
"reset": "Reset Turnip Prophet",
"reset-warning": "Are you sure you want to reset all fields?\n\nThis cannot be undone!"
},
"weekdays": {
"monday": "Monday",
"tuesday": "Tuesday",
"wednesday": "Wednesday",
"thursday": "Thursday",
"friday": "Friday",
"saturday" : "Saturday",
"sunday": "Sunday",
"abr": {
"monday": "Mon ",
"tuesday": "Tue ",
"wednesday": "Wed ",
"thursday": "Thu ",
"friday": "Fri ",
"saturday" : "Sat "
}
},
"times": {
"morning": "AM",
"afternoon": "PM"
},
"output": {
"title": "Output",
"chance": "% Chance",
"to": "to",
"minimum": "Guaranteed Minimum",
"maximum": "Guaranteed Maximum",
"chart": {
"input": "Input Price",
"minimum": "Minimum",
"maximum": "Maximum"
}
},
"textbox": {
"description": "After you've listed some turnip prices, the Turnip Prophet will run some numbers and display the different possible patterns that your island may experience.",
"development": "This app is still in development, but will improve over time!",
"thanks": "None of this would have been possible without <a href=\"https://twitter.com/_Ninji/status/1244818665851289602?s=20\">Ninji's work</a> figuring out just how Timmy and Tommy value their turnips.",
"support": "Support, comments and contributions are available through <a href=\"https://github.com/mikebryant/ac-nh-turnip-prices/issues\">Github</a>",
"contributors-text": "Oh! And let's not forget to thank those who have contributed so far!",
"contributors": "Contributors"
}
}

Loading…
Cancel
Save