diff --git a/_locales/de/messages.json b/_locales/de/messages.json index 5391825..7b4ec9a 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -84,6 +84,11 @@ "description": "" }, + "popup_html_configs_switch_filter_title": { + "message": "Der Filter-Schalter aktiviert die Reinigungsfunktion von ClearURLs, wenn sie die Funktion ausschalten, dann deaktivieren sie das gesamte Addon", + "description": "" + }, + "popup_html_configs_switch_log": { "message": "Protokoll", "description": "" @@ -99,6 +104,11 @@ "description": "" }, + "popup_html_configs_switch_badges_title": { + "message": "Zeigt die Anzahl der gereinigten URLs an", + "description": "" + }, + "popup_html_statistics_head": { "message": "Statistik", "description": "" diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 350a5ec..4a9de24 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -84,6 +84,11 @@ "description": "" }, + "popup_html_configs_switch_filter_title": { + "message": "The filters switch activates the cleaning functionality of ClearURLs. If you disable this option, the whole addon is disabled", + "description": "" + }, + "popup_html_configs_switch_log": { "message": "Logging", "description": "" @@ -99,6 +104,11 @@ "description": "" }, + "popup_html_configs_switch_badges_title": { + "message": "Show number of cleaned urls", + "description": "" + }, + "popup_html_statistics_head": { "message": "Statistics", "description": "" diff --git a/core_js/popup_new.js b/core_js/popup_new.js index 8d22249..271ab2e 100644 --- a/core_js/popup_new.js +++ b/core_js/popup_new.js @@ -140,22 +140,42 @@ $(document).ready(function(){ */ function setText() { - $('#loggingPage').text(translate('popup_html_log_head')); - $('#loggingPage').prop('title', translate('popup_html_log_head_title')); - $('#reset_counter_btn').text(translate('popup_html_statistics_reset_button')); - $('#reset_counter_btn').prop('title', translate('popup_html_statistics_reset_button_title')); - $('#rules_status_head').text(translate('popup_html_rules_status_head')); - $('#statistics_percentage').text(translate('popup_html_statistics_percentage')); - $('#statistics_blocked').text(translate('popup_html_statistics_blocked')); - $('#statistics_elements').text(translate('popup_html_statistics_elements')); - $('#statistics_head').text(translate('popup_html_statistics_head')); - $('#configs_switch_badges').text(translate('popup_html_configs_switch_badges')); - $('#configs_switch_log').text(translate('popup_html_configs_switch_log')); - $('#configs_switch_log').prop('title', translate('popup_html_configs_switch_log_title')); - $('#configs_switch_filter').text(translate('popup_html_configs_switch_filter')); - $('#configs_head').text(translate('popup_html_configs_head')); - $('#configs_switch_statistics').text(translate('configs_switch_statistics')); - $('#configs_switch_statistics').prop('title', translate('configs_switch_statistics_title')); + injectText('loggingPage','popup_html_log_head'); + injectText('reset_counter_btn','popup_html_statistics_reset_button'); + injectText('rules_status_head','popup_html_rules_status_head'); + injectText('statistics_percentage','popup_html_statistics_percentage'); + injectText('statistics_blocked','popup_html_statistics_blocked'); + injectText('statistics_elements','popup_html_statistics_elements'); + injectText('statistics_head','popup_html_statistics_head'); + injectText('configs_switch_badges','popup_html_configs_switch_badges'); + injectText('configs_switch_log','popup_html_configs_switch_log'); + injectText('configs_switch_filter','popup_html_configs_switch_filter'); + injectText('configs_head','popup_html_configs_head'); + injectText('configs_switch_statistics','configs_switch_statistics'); +} + +/** + * Helper function to inject the translated text and tooltip. + * + * @param {string} id ID of the HTML element + * @param {string} attribute Name of the attribute used for localization + * @param {boolean} tooltip + */ +function injectText(id, attribute, tooltip) +{ + object = $('#'+id); + object.text(translate(attribute)); + + /* + This function will throw an error if no translation + is found for the tooltip. This is a planned error. + */ + tooltip = translate(attribute+"_title"); + + if(tooltip != "") + { + object.prop('title', tooltip); + } } /**