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

master
emy 6 years ago
parent eae73e2163
commit 4361dbf8ad
  1. 15
      contrib/fr/overrides/index.html
  2. 8
      scripts/index.js

@ -6,6 +6,17 @@ window.avatar = "{{ avatar }}";
window.your_name = "{{ _cfg("your-name") }}"; window.your_name = "{{ _cfg("your-name") }}";
window.default_amount = {{ _cfg("default-amount") }}; window.default_amount = {{ _cfg("default-amount") }};
window.default_type = "{{ _cfg("default-type") }}"; 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 %} {% if user %}
window.email = "{{user.email}}"; window.email = "{{user.email}}";
{% endif %} {% endif %}
@ -20,9 +31,9 @@ window.email = "{{user.email}}";
<div class="col-md-8 col-md-offset-2"> <div class="col-md-8 col-md-offset-2">
<img <img
class="pull-right" class="pull-right"
src="https://xn--transposes-i7a.eu/_media/wiki:logo.png" src="{{ avatar }}?s=128"
style="border-radius: 5px; margin-left: 1rem" style="border-radius: 5px; margin-left: 1rem"
width="" height="128" /> width="128" height="128" />
<h1>Soutenir le {{ _cfg("your-name") }}</h1> <h1>Soutenir le {{ _cfg("your-name") }}</h1>
{% include "summary.html" %} {% include "summary.html" %}
</div> </div>

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

Loading…
Cancel
Save