diff --git a/extension/_locales/en/messages.json b/extension/_locales/en/messages.json
new file mode 100644
index 0000000..3d67009
--- /dev/null
+++ b/extension/_locales/en/messages.json
@@ -0,0 +1,98 @@
+{
+ "extensionName": {
+ "message": "User-Agent Switcher and Manager",
+ "description": "Name of the extension."
+ },
+ "extensionDescription": {
+ "message": "Spoof websites trying to gather information about your web navigation to deliver distinct content you may not want",
+ "description": "Description of the extension."
+ },
+ "testUA": {
+ "message": "Test UA",
+ "description": ""
+ },
+ "userAgentSwitcherandManagerOptions": {
+ "message": "User-Agent Switcher and Manager :: Options",
+ "description": ""
+ },
+ "blackListMode": {
+ "message": "Black-List Mode",
+ "description": ""
+ },
+ "description": {
+ "message": "Description",
+ "description": ""
+ },
+ "blackListModeDescription": {
+ "message": "Apply the custom user-agent string to all tabs except the tabs with the following top-level hostnames (comma-separated list of hostnames). Note that even if a window-based user-agent string is set from the toolbar popup, your browser's default user-agent string is used.",
+ "description": ""
+ },
+ "whiteListMode": {
+ "message": "White-List Mode",
+ "description": ""
+ },
+ "whiteListModeDescription": {
+ "message": "Only apply the custom user-agent string to the tabs with following top-level hostnames. Note that if a window-based user-agent string is set from the toolbar popup, this user-agent will overwrite the global one.",
+ "description": ""
+ },
+ "customMode": {
+ "message": "Custom Mode",
+ "description": ""
+ },
+ "cache": {
+ "message": "Use caching to improve performance (recommended value is true). Uncheck this option only if you are using the custom mode and also you need the user-agent string to be altered from the provided list on every single request.",
+ "description": ""
+ },
+ "exactMatch": {
+ "message": "Use exact matching (if checked, you will need to insert all sub-domains in the white-list and black-list modes to be considered. If unchecked, all the sub-domains are passing the matching condition (e.g: www.google.com passes the matching if google.com is in the list))",
+ "description": ""
+ },
+ "faqs": {
+ "message": "Open FAQs page on updates",
+ "description": ""
+ },
+ "log": {
+ "message": "Display debugging info in the browser console",
+ "description": ""
+ },
+ "disableSpoofing": {
+ "message": "Disable Spoofing",
+ "description": ""
+ },
+ "disableSpoofingDescription": {
+ "message": "A comma-separated list of keywords that the extension should not spoof the user-agent header. Use this list to protect URLs that contain these protected keywords. Each keyword need to be at least 5 char long.",
+ "description": ""
+ },
+ "customUserAgentParsing": {
+ "message": "Custom User-Agent Parsing",
+ "description": ""
+ },
+ "siblingHostnames": {
+ "message": "Sibling Hostnames",
+ "description": ""
+ },
+ "importSettings": {
+ "message": "Import Settings",
+ "description": ""
+ },
+ "exportSettings": {
+ "message": "Export Settings",
+ "description": ""
+ },
+ "help": {
+ "message": "FAQs Page (Help)",
+ "description": ""
+ },
+ "donate": {
+ "message": "Support Development",
+ "description": ""
+ },
+ "reset": {
+ "message": "Reset",
+ "description": ""
+ },
+ "save": {
+ "message": "Save",
+ "description": ""
+ }
+}
\ No newline at end of file
diff --git a/extension/_locales/ru/messages.json b/extension/_locales/ru/messages.json
new file mode 100644
index 0000000..b59947c
--- /dev/null
+++ b/extension/_locales/ru/messages.json
@@ -0,0 +1,98 @@
+{
+ "extensionName": {
+ "message": "User-Agent Switcher and Manager",
+ "description": "Name of the extension."
+ },
+ "extensionDescription": {
+ "message": "Подменяет User-Agent на веб-сайтах, пытающихся собрать информацию о ваших путешествиях по сети и выдать не нужное вам содержимое",
+ "description": "Description of the extension."
+ },
+ "testUA": {
+ "message": "Тест UA",
+ "description": ""
+ },
+ "userAgentSwitcherandManagerOptions": {
+ "message": "User-Agent Switcher and Manager :: Настройки",
+ "description": ""
+ },
+ "blackListMode": {
+ "message": "Режим черного списка",
+ "description": ""
+ },
+ "description": {
+ "message": "Описание",
+ "description": ""
+ },
+ "blackListModeDescription": {
+ "message": "Применить заданную строку User-Agent ко всем вкладкам за исключением содержащих следующие домены верхнего уровня (список доменов разделяется запятыми). Важно: даже если применяемая к окну строка User-Agent задана из всплывающего окна, для этого списка будет использоваться строка User-Agent вашего браузера по умолчанию.",
+ "description": ""
+ },
+ "whiteListMode": {
+ "message": "Режим белого списка",
+ "description": ""
+ },
+ "whiteListModeDescription": {
+ "message": "Применять заданную строку User-Agent только к вкладкам, содержащим следующие домены верхнего уровня. Важно: даже если применяемая к окну строка User-Agent задана из всплывающего окна, данный User-Agent заменит собой глобальный.",
+ "description": ""
+ },
+ "customMode": {
+ "message": "Режим настройки",
+ "description": ""
+ },
+ "cache": {
+ "message": "Использовать кэширование для улучшения производительности (рекомендуемое значение true). Отключите эту опцию только при использовании режима настройки, когда нужно изменять строку User-Agent с помощью списка при каждом запросе.",
+ "description": ""
+ },
+ "exactMatch": {
+ "message": "Использовать точное совпадение (если включено, вам нужно добавлять все поддомены в черный и белый списки как задумано. Если выключено, все поддомены проходят проверку на совпадение (например, www.google.com проходит проверку, если google.com находится в списке))",
+ "description": ""
+ },
+ "faqs": {
+ "message": "Открывать страницу FAQ при обновлении",
+ "description": ""
+ },
+ "log": {
+ "message": "Отображать отладочную информацию в консоли браузера",
+ "description": ""
+ },
+ "disableSpoofing": {
+ "message": "Отключить подмену User-Agent",
+ "description": ""
+ },
+ "disableSpoofingDescription": {
+ "message": "Разделяемый запятыми список ключевых слов, на которых расширение не должно подменять заголовок User-Agent. Используйте этот список для защиты URL, содержащих эти ключевые слова. Каждое ключевое слово должно быть длиной не менее 5 символов.",
+ "description": ""
+ },
+ "customUserAgentParsing": {
+ "message": "Парсинг заданного User-Agent",
+ "description": ""
+ },
+ "siblingHostnames": {
+ "message": "Родственные домены",
+ "description": ""
+ },
+ "importSettings": {
+ "message": "Импортировать настройки",
+ "description": ""
+ },
+ "exportSettings": {
+ "message": "Экспортировать настройки",
+ "description": ""
+ },
+ "help": {
+ "message": "Страница FAQ (Помощь)",
+ "description": ""
+ },
+ "donate": {
+ "message": "Поддержать разработку",
+ "description": ""
+ },
+ "reset": {
+ "message": "Сбросить",
+ "description": ""
+ },
+ "save": {
+ "message": "Сохранить",
+ "description": ""
+ }
+}
\ No newline at end of file
diff --git a/extension/data/options/index.html b/extension/data/options/index.html
index e327e13..ea732c7 100644
--- a/extension/data/options/index.html
+++ b/extension/data/options/index.html
@@ -1,7 +1,7 @@
- User-Agent Switcher and Manager :: Options
+ User-Agent Switcher and Manager :: Options
@@ -9,70 +9,70 @@
-
- Description
+
+ Description
-
Apply the custom user-agent string to all tabs except the tabs with the following top-level hostnames (comma-separated list of hostnames). Note that even if a window-based user-agent string is set from the toolbar popup, your browser's default user-agent string is used.
+
Apply the custom user-agent string to all tabs except the tabs with the following top-level hostnames (comma-separated list of hostnames). Note that even if a window-based user-agent string is set from the toolbar popup, your browser's default user-agent string is used.
-
- Description
+
+ Description
-
Only apply the custom user-agent string to the tabs with following top-level hostnames. Note that if a window-based user-agent string is set from the toolbar popup, this user-agent will overwrite the global one.
+
Only apply the custom user-agent string to the tabs with following top-level hostnames. Note that if a window-based user-agent string is set from the toolbar popup, this user-agent will overwrite the global one.
-
- Description
+
+ Description
-
Try to resolve the user-agent string from a JSON object; otherwise either use the default user-agent string or use the one that the user is set from the popup interface. Use "*" as the hostname to match all domains. You can randomly select from multiple user-agent strings by providing an array instead of a fixed string. If there is a "_" key in your JSON object which refers to an array of hostnames, then the extension only randomly selects the user-agent string once for each hostname inside this list. This is useful if you don't want the random user-agent to change until this browser session is over. Press here to insert a sample JSON object.
+
Try to resolve the user-agent string from a JSON object; otherwise either use the default user-agent string or use the one that the user is set from the popup interface. Use "*" as the hostname to match all domains. You can randomly select from multiple user-agent strings by providing an array instead of a fixed string. If there is a "_" key in your JSON object which refers to an array of hostnames, then the extension only randomly selects the user-agent string once for each hostname inside this list. This is useful if you don't want the random user-agent to change until this browser session is over. Press here to insert a sample JSON object.
-
+
-
+
-
+
-
+
-
Disable Spoofing
- Description
+
Disable Spoofing
+ Description
-
A comma-separated list of keywords that the extension should not spoof the user-agent header. Use this list to protect URLs that contain these protected keywords. Each keyword need to be at least 5 char long.
+
A comma-separated list of keywords that the extension should not spoof the user-agent header. Use this list to protect URLs that contain these protected keywords. Each keyword need to be at least 5 char long.
-
Custom User-Agent Parsing
- Description
+
Custom User-Agent Parsing
+ Description
-
A JSON object to bypass the internal user-agent string parsing method. The keys are the actual user-agent strings and the value of each key is an object of the keys that need to be set for the "navigator" object. You can use the "[delete]" keyword if you want a key in the "navigator" object to get deleted. Press here to insert a sample JSON object.
+
A JSON object to bypass the internal user-agent string parsing method. The keys are the actual user-agent strings and the value of each key is an object of the keys that need to be set for the "navigator" object. You can use the "[delete]" keyword if you want a key in the "navigator" object to get deleted. Press here to insert a sample JSON object.
-
Sibling Hostnames
- Description
+
Sibling Hostnames
+ Description
-
A JSON array that contains one or more groups of hostnames to have a single user-agent string per group. For all hostnames in one group, the user-agent string calculation only occurs once, and all the other members use the same calculated string. This is useful to make sure a group of connected websites only access to the same user-agent string. Press here to insert a sample JSON array.
+
A JSON array that contains one or more groups of hostnames to have a single user-agent string per group. For all hostnames in one group, the user-agent string calculation only occurs once, and all the other members use the same calculated string. This is useful to make sure a group of connected websites only access to the same user-agent string. Press here to insert a sample JSON array.
This extension supports managed storage. All the preferences can be pre-configured by the domain administrator
-
-
+
+
-
-
-
-
+
+
+
+
diff --git a/extension/data/options/index.js b/extension/data/options/index.js
index 3ee487c..c6be5a6 100644
--- a/extension/data/options/index.js
+++ b/extension/data/options/index.js
@@ -258,3 +258,15 @@ document.getElementById('toggle-parser-desc').addEventListener('click', () => {
document.getElementById('toggle-sibling-desc').addEventListener('click', () => {
document.querySelector('[for="toggle-sibling-desc"]').classList.toggle('hidden');
});
+
+
+const textElements = document.querySelectorAll('[data-localize]');
+textElements.forEach((e) => {
+ const ref = e.dataset.localize;
+ if (ref) {
+ const translated= ref.replace(/__MSG_(\w+)__/g, (match, theGroup) => chrome.i18n.getMessage(theGroup));
+ if (translated) {
+ e.innerText = translated;
+ }
+ }
+});
diff --git a/extension/manifest.json b/extension/manifest.json
index 9aa4de6..98e86a0 100755
--- a/extension/manifest.json
+++ b/extension/manifest.json
@@ -1,10 +1,11 @@
{
"manifest_version": 2,
- "name": "User-Agent Switcher and Manager",
+ "name": "__MSG_extensionName__",
"short_name": "useragent-switcher",
"version": "0.4.3",
+ "default_locale": "en",
- "description": "Spoof websites trying to gather information about your web navigation to deliver distinct content you may not want",
+ "description": "__MSG_extensionDescription__",
"permissions": [
"tabs",