French translation for index.js. index.js modified to use an i18n array.

This commit is contained in:
emy 2018-09-16 20:19:14 +02:00
parent eae73e2163
commit 4361dbf8ad
2 changed files with 17 additions and 6 deletions

View File

@ -6,6 +6,17 @@ window.avatar = "{{ avatar }}";
window.your_name = "{{ _cfg("your-name") }}";
window.default_amount = {{ _cfg("default-amount") }};
window.default_type = "{{ _cfg("default-type") }}";
// Traduction du /script/index.js
const i18n = {
"Monthly Donation": "Don mensuel",
"One-time Donation": "Don Unique",
"Donate ": "Donner ";
"Submitting...": "Validation...";
"Donate": "Donner";
};
// Fin de traduction
{% if user %}
window.email = "{{user.email}}";
{% endif %}
@ -20,9 +31,9 @@ window.email = "{{user.email}}";
<div class="col-md-8 col-md-offset-2">
<img
class="pull-right"
src="https://xn--transposes-i7a.eu/_media/wiki:logo.png"
src="{{ avatar }}?s=128"
style="border-radius: 5px; margin-left: 1rem"
width="" height="128" />
width="128" height="128" />
<h1>Soutenir le {{ _cfg("your-name") }}</h1>
{% include "summary.html" %}
</div>

View File

@ -75,12 +75,12 @@
key: window.stripe_key,
image: window.avatar,
locale: 'auto',
description: donation.type == "monthly" ? "Monthly Donation" : "One-time Donation",
panelLabel: "Donate {{amount}}",
description: donation.type == "monthly" ? i18n["Monthly Donation"] : i18n["One-time Donation"],
panelLabel: i18n["Donate "] + "{{amount}}",
amount: donation.amount,
token: function(token) {
e.target.setAttribute("disabled", "");
e.target.textContent = "Submitting...";
e.target.textContent = i18n["Submitting..."];
var data = new FormData();
data.append("stripe_token", token.id);
@ -109,7 +109,7 @@
errors.classList.remove("hidden");
errors.querySelector("p").textContent = res.reason;
e.target.removeAttribute("disabled");
e.target.textContent = "Donate";
e.target.textContent = i18n["Donate"];
}
};
xhr.send(data);