Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

[WIP] internationalization #33

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -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"
}


}
27 changes: 27 additions & 0 deletions _locales/fr/messages.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
12 changes: 7 additions & 5 deletions browser_action/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
<div class="panel-section panel-section-formElements">
<div class="panel-formElements-item">
<button id="stop" class="expander">
Mettre en pause la surveillance des RDV
<!-- Mettre en pause la surveillance des RDV -->
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this syntax supported?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'm not sure how to parse your question. 😕
I just kept the original texts as html comments, which are indeed supported by Firefox: the texts are hidden in the html rendering and added later by the js code. Is this what you asked?

</button>
<button id="start" class="expander">
Reprendre la surveillance des RDV
<!-- Reprendre la surveillance des RDV -->
</button>
</div>

<div class="panel-formElements-item">
<div>
<input type="radio" name="autoBook" id="disableAutoBook" checked />
<label for="disableAutoBook"
>Ouvrir un onglet lorsqu'une réservation est disponible</label
>
<label id="disableAutoBook_label" for="disableAutoBook">
<!-- Ouvrir un onglet lorsqu'une réservation est disponible -->
</label>
</div>

<div>
Expand Down Expand Up @@ -114,5 +114,7 @@
</template>

<script src="index.js"></script>
<script type="text/javascript" src="locales.js"></script>

</body>
</html>
10 changes: 10 additions & 0 deletions browser_action/locales.js
Original file line number Diff line number Diff line change
@@ -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") ;

}
3 changes: 2 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"default_locale": "en",
"manifest_version": 2,
"name": "vaccin.click",
"version": "1.4",
"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": {
Expand Down