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"
},
"toggleBlokingAds": {
elmarceloc marked this conversation as resolved.
Show resolved Hide resolved
"message": "\"Blocking Ads\" message Off / On",
"description": "Toggle the 'blocking ads...' banner"
},
"realodTabsWarning": {
elmarceloc marked this conversation as resolved.
Show resolved Hide resolved
"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"
},
"toggleBlokingAds": {
elmarceloc marked this conversation as resolved.
Show resolved Hide resolved
"message": "Mensaje de \"Bloqueando anuncios\" Off / On",
"description": "Alterna el mensaje de 'Bloqueando anuncios...'"
elmarceloc marked this conversation as resolved.
Show resolved Hide resolved
},
"realodTabsWarning": {
elmarceloc marked this conversation as resolved.
Show resolved Hide resolved
"message": "Cada vez que cambies alguna configuracion, debes volver a recargar la(s) pestaña(s) de Twitch."
elmarceloc marked this conversation as resolved.
Show resolved Hide resolved
},
"popupReminder": {
"message": "Puedes acceder a estas configuraciónes en cualquier momento haciendo clic el icono de la extensión"
elmarceloc marked this conversation as resolved.
Show resolved Hide resolved
},
"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..."
}
}
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="toggleBlokingAds">"Blocking Ads" message Off / On</span>
elmarceloc marked this conversation as resolved.
Show resolved Hide resolved

<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="realodTabsWarning">Whenever you change a setting, you have to reload the Twitch tab(s).</p>
elmarceloc marked this conversation as resolved.
Show resolved Hide resolved
<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