From e50f9c1510cd2b79b39548a97eb6c06093defb6f Mon Sep 17 00:00:00 2001 From: VAGINAY Athenais Date: Thu, 20 May 2021 17:41:37 +0200 Subject: [PATCH] test internationalization --- _locales/en/messages.json | 29 +++++++++++++++++++++++++++++ _locales/fr/messages.json | 27 +++++++++++++++++++++++++++ browser_action/index.html | 12 +++++++----- browser_action/locales.js | 10 ++++++++++ manifest.json | 3 ++- 5 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 _locales/en/messages.json create mode 100644 _locales/fr/messages.json create mode 100644 browser_action/locales.js diff --git a/_locales/en/messages.json b/_locales/en/messages.json new file mode 100644 index 0000000..b317b5d --- /dev/null +++ b/_locales/en/messages.json @@ -0,0 +1,29 @@ +{ + "extensionName": { + "message": "vaccin.click", + "description": "Name of the extension." + }, + + "extensionDescription": { + "message": "Find and reserve automatically your COVID-19 vaccination slot.", + "description": "Description of the extension." + }, + + "default_title": { + "message": "vaccin.click : my COVID-19 vaccin in 1 click!" + }, + + "button_stop": { + "message": "Stop looking for appointments" + }, + + "button_start": { + "message": "Start looking for appointments" + }, + + "radio_disableAutoBook_label": { + "message": "Open a tab when a reservation is available" + } + + +} diff --git a/_locales/fr/messages.json b/_locales/fr/messages.json new file mode 100644 index 0000000..4b6af0c --- /dev/null +++ b/_locales/fr/messages.json @@ -0,0 +1,27 @@ +{ + "extensionName": { + "message": "vaccin.click", + "description": "Nom de l'extension." + }, + + "extensionDescription": { + "message": "Trouvez et réservez automatiquement votre créneau de vaccination COVID-19.", + "description": "Description de extension." + }, + + "default_title": { + "message": "vaccin.click : mon vaccin COVID-19 en 1 click !" + }, + + "button_stop": { + "message": "Mettre en pause la surveillance des RDV" + }, + + "button_start": { + "message": "Reprendre la surveillance des RDV" + }, + + "radio_disableAutoBook_label": { + "message": "Ouvrir un onglet lorsqu'une réservation est disponible" + } +} diff --git a/browser_action/index.html b/browser_action/index.html index 420a844..70bcf40 100644 --- a/browser_action/index.html +++ b/browser_action/index.html @@ -22,19 +22,19 @@
- +
@@ -114,5 +114,7 @@ + + diff --git a/browser_action/locales.js b/browser_action/locales.js new file mode 100644 index 0000000..d359e16 --- /dev/null +++ b/browser_action/locales.js @@ -0,0 +1,10 @@ +var doc=window.top.document + +if(doc != null) { + console.log("starting setting text based on language"); + + document.getElementById("stop").textContent = browser.i18n.getMessage("button_stop") ; + document.getElementById("start").textContent = browser.i18n.getMessage("button_start") ; + document.getElementById("disableAutoBook_label").textContent = browser.i18n.getMessage("radio_disableAutoBook_label") ; + +} diff --git a/manifest.json b/manifest.json index 7ce740e..4f5a8e5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,8 +1,9 @@ { + "default_locale": "en", "manifest_version": 2, "name": "vaccin.click", "version": "1.2", - "description": "Trouvez et réservez automatiquement votre créneau de vaccination COVID-19.", + "description": "__MSG_extensionDescription__", "author": "Kévin Dunglas", "homepage_url": "https://dunglas.fr", "icons": {