Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internacionalization + spanish traduction #44

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
28 changes: 28 additions & 0 deletions chrome/_locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"extDescription": {
"message": "Blocks Ads on Twitch.tv.",
"description": "The extension short description."
},
"toggleAdblocker": {
"message": "Twitch Adblocker Off / On"
},
"toggleBlockingAds": {
"message": "\"Blocking Ads\" message Off / On",
"description": "Toggle the 'blocking ads...' banner"
},
"reloadTabsWarning": {
"message": "Whenever you change a setting, you have to reload the Twitch tab(s)."
},
"popupReminder": {
"message": "You can access these settings at any time by clicking on the extension icon"
},
"installThanks": {
"message": "Thank you for installing Twitch Adblock!"
},
"disableOtherAdblockers": {
"message": "In order to provide full functionality, please make sure that you disable any other Adblocker for Twitch."
},
"blockingAds":{
"message": "Blocking ads..."
}
}
28 changes: 28 additions & 0 deletions chrome/_locales/es/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"extDescription": {
"message": "Bloquea los anuncios de Twitch.tv.",
"description": "La descripción de la extensión."
},
"toggleAdblocker": {
"message": "Bloquear anuncios Off / On"
},
"toggleBlockingAds": {
"message": "Mensaje de \"Bloqueando anuncios\" Off / On",
"description": "Activa/desactiva el mensaje de 'Bloqueando anuncios...'"
},
"reloadTabsWarning": {
"message": "Cada vez que cambies alguna configuracion, deberás recargar la(s) pestaña(s) de Twitch."
},
"popupReminder": {
"message": "Puedes acceder a estas configuraciónes en cualquier momento haciendo clic en el icono de la extensión"
},
"installThanks": {
"message": "¡Gracias por instalar Twitch Adblock!"
},
"disableOtherAdblockers": {
"message": "Con el fin de proporcionar una funcionalidad completa, asegúrese de deshabilitar cualquier otro bloqueador de anuncios para Twitch."
},
"blockingAds":{
"message": "Bloqueando anuncios..."
}
}
28 changes: 28 additions & 0 deletions chrome/_locales/fr/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"extDescription": {
"message": "Bloque les publicités de Twitch.tv.",
"description": "La description de l'extension."
},
"toggleAdblocker": {
"message": "Bloquer les publicités Off / On"
},
"toggleBlockingAds": {
"message": "Message de \"Blocage des publicités\" Off / On",
"description": "Active/désactive le message de 'Blocage des publicités...'"
},
"reloadTabsWarning": {
"message": "Chaque fois que vous modifiez un paramètre, vous devez recharger le(s) onglet(s) Twitch."
},
"popupReminder": {
"message": "Vous pouvez accéder à ces paramètres à tout moment en cliquant sur l'icône d'extension"
},
"installThanks": {
"message": "Merci d'avoir installé Twitch Adblock !"
},
"disableOtherAdblockers": {
"message": "Afin d'assurer une fonctionnalité complète, veillez à désactiver tout autre bloqueur de publicité pour Twitch."
},
"blockingAds":{
"message": "Blocage des publicités..."
}
}
28 changes: 28 additions & 0 deletions chrome/_locales/pt_BR/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"extDescription": {
"message": "Bloquear anúncios nas transmissões da Twitch.tv.",

Choose a reason for hiding this comment

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

Could be simplified to "Bloqueia anúncios na Twitch.tv."

"description": "A descrição da extensão."
},
"toggleAdblocker": {
"message": "Bloquear anúncios"

Choose a reason for hiding this comment

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

Can I suggest "Bloquear anúncios Off / On" to keep the EN format?

},
"toggleBlockingAds": {
"message": "Aviso de \"Bloqueando anúncios\"",

Choose a reason for hiding this comment

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

It's not entirely a warning message, "Mensagem de "Bloqueando anúncios" Off / On" is my suggestion

"description": "Ativar ou desativar a mensagem 'Bloqueando anúncios...'"
},
"reloadTabsWarning": {
"message": "Sempre que você alterar uma configuração da extensão, você vai precisar recarregar a(s) guia(s) da Twitch."
Copy link

@diomonogatari diomonogatari Nov 29, 2022

Choose a reason for hiding this comment

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

Could be simplified to:
"Sempre que alterar uma configuração, você precisa de recarregar a(s) guia(s) da Twitch.".

Also, is the term "guia" actually used daily to refer to browser tabs? From experience, the loan word "tabs" is the most used term in PT

},
"popupReminder": {
"message": "Você pode acessar as configurações a qualquer momento apenas clicando no ícone da extensão"

Choose a reason for hiding this comment

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

Can I suggest "Poderá acessar às configurações a qualquer momento ao clicar no ícone da extensão" ?

},
"installThanks": {
"message": "Obrigado por usar o Twitch Adblock!"
},
"disableOtherAdblockers": {
"message": "Para a extensão funcionar corretamente, desative outros bloqueadores de anúncio para a Twitch."
},
"blockingAds":{
"message": "Bloqueando anúncios..."
}
}
5 changes: 3 additions & 2 deletions chrome/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"description": "Blocks Ads on Twitch.tv.",
"description": "__MSG_extDescription__",
"manifest_version": 3,
"name": "Twitch Adblock",
"version": "5.4.0",
Expand Down Expand Up @@ -34,5 +34,6 @@
"web_accessible_resources": [{
"resources": ["remove_video_ads.js"],
"matches": ["https://*.twitch.tv/*"]
}]
}],
"default_locale": "en"
}
7 changes: 4 additions & 3 deletions chrome/popup/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,21 @@
<div id="popup-content">
<img src="logo.png" height="100%" width="100%" alt="Twitch Adblock" />
<p class="p2">
Twitch Adblocker Off / On
<span data-i18n="toggleAdblocker">Twitch Adblocker Off / On</span>
<label class="switch">
<input type="checkbox" name="checkbox1" checked />
<span class="slider round"></span>
</label>
</p>
<p class="p2">
"Blocking Ads" message Off / On
<span data-i18n="toggleBlockingAds">"Blocking Ads" message Off / On</span>

<label class="switch">
<input type="checkbox" name="checkbox2" checked />
<span class="slider round"></span>
</label>
</p>
<p class="p2">Whenever you change a setting, you have to reload the Twitch tab(s).</p>
<p class="p2" data-i18n="reloadTabsWarning">Whenever you change a setting, you have to reload the Twitch tab(s).</p>
<p class="p2" style="text-align: center;">
<a href="https://github.com/cleanlock/VideoAdBlockForTwitch" target="_blank"><img src="github.png" alt="Github" height="42px" width="42px"></a>
<a href="https://discord.gg/PSgWqf3v8V" target="_blank"><img src="discord.png" alt="Discord" height="42px" width="42px" style="margin-left: 10px;"></a>
Expand Down
10 changes: 5 additions & 5 deletions chrome/popup/install.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,23 @@
<body>
<div id="popup-content">
<img src="logo.png" height="100%" width="100%" alt="Twitch Adblock" />
<p class="p1">Thank you for installing Twitch Adblock!</p>
<p class="p1">In order to provide full functionality, please make sure that you disable any other Adblocker for Twitch.</p>
<p class="p1" data-i18n="installThanks">Thank you for installing Twitch Adblock!</p>
<p class="p1" data-i18n="disableOtherAdblockers">In order to provide full functionality, please make sure that you disable any other Adblocker for Twitch.</p>
<p class="p2">
Twitch Adblocker Off / On
<span data-i18n="toggleAdblocker">Twitch Adblocker Off / On</span>
<label class="switch">
<input type="checkbox" name="checkbox1" checked />
<span class="slider round"></span>
</label>
</p>
<p class="p2">
"Blocking Ads" message Off / On
<span data-i18n="toggleBlokingAds">"Blocking Ads" message Off / On</span>
<label class="switch">
<input type="checkbox" name="checkbox2" checked />
<span class="slider round"></span>
</label>
</p>
<p class="p1">You can access these settings at any time by clicking on the extension icon.</p>
<p class="p1" data-i18n="popupReminder">You can access these settings at any time by clicking on the extension icon</p>
<p class="p2" style="text-align: center;">
<a href="https://github.com/cleanlock/VideoAdBlockForTwitch" target="_blank"><img src="github.png" alt="Github" height="42px" width="42px"></a>
<a href="https://discord.gg/PSgWqf3v8V" target="_blank"><img src="discord.png" alt="Discord" height="42px" width="42px" style="margin-left: 10px;"></a>
Expand Down
9 changes: 8 additions & 1 deletion chrome/popup/popupjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,11 @@ function restoreOptions() {
});
}

document.addEventListener('DOMContentLoaded', restoreOptions);
document.addEventListener('DOMContentLoaded', restoreOptions);

// internacionalization (https://stackoverflow.com/questions/25467009/internationalization-of-html-pages-for-my-google-chrome-extension)

document.querySelectorAll('[data-i18n]').forEach(elem => {
elem.innerText = chrome.i18n.getMessage(elem.dataset.i18n)
})

2 changes: 1 addition & 1 deletion chrome/remove_video_ads.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ window.Worker = class Worker extends oldWorker {
if (adBlockDiv == null) {
adBlockDiv = getAdBlockDiv();
}
adBlockDiv.P.textContent = 'Blocking ads...';
adBlockDiv.P.textContent = chrome.i18n.getMessage("blockingAds");
adBlockDiv.style.display = 'block';
} else if (e.data.key == 'HideAdBlockBanner') {
if (adBlockDiv == null) {
Expand Down