From af65a4743f26d6f26e6d42c34c91c550155a4e4d Mon Sep 17 00:00:00 2001 From: tfennelly Date: Fri, 2 Oct 2015 12:29:06 +0100 Subject: [PATCH] i18n on the hardcoded text --- .../src/main/resources/hudson/PluginManager/_table.js | 11 ++++++++--- .../resources/hudson/PluginManager/installed.jelly | 8 ++++++++ war/src/main/webapp/css/style.css | 4 ++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/core/src/main/resources/hudson/PluginManager/_table.js b/core/src/main/resources/hudson/PluginManager/_table.js index f6fede2004..1573a8b5ec 100644 --- a/core/src/main/resources/hudson/PluginManager/_table.js +++ b/core/src/main/resources/hudson/PluginManager/_table.js @@ -76,6 +76,11 @@ Behaviour.specify("#filter-box", '_table', 0, function(e) { if (!pluginTRs) { return; } + + var pluginI18n = select('.plugins.i18n'); + function i18n(messageId) { + return pluginI18n.readAttribute('data-' + messageId); + } // Create a map of the plugin rows, making it easy to index them. var plugins = {}; @@ -176,7 +181,7 @@ Behaviour.specify("#filter-box", '_table', 0, function(e) { var dependenciesDiv = pluginMetadata.dependenciesDiv; var dependencySpans = pluginMetadata.dependencies; - infoContainer.update('
This plugin cannot be enabled
It has one or more disabled dependencies.
'); + infoContainer.update('
' + i18n('cannot-enable') + '
' + i18n('disabled-dependencies') + '.
'); // Go through each dependency element. Show the spans where the dependency is // disabled. Hide the others. @@ -203,7 +208,7 @@ Behaviour.specify("#filter-box", '_table', 0, function(e) { var dependantsDiv = pluginMetadata.dependantsDiv; var dependantSpans = pluginMetadata.dependants; - infoContainer.update('
This plugin cannot be disabled
It has one or more enabled plugins that depend on it.
'); + infoContainer.update('
' + i18n('cannot-disable') + '
' + i18n('enabled-dependants') + '.
'); // Go through each dependant element. Show the spans where the dependant is // enabled. Hide the others. @@ -241,7 +246,7 @@ Behaviour.specify("#filter-box", '_table', 0, function(e) { var dependantsDiv = pluginMetadata.dependantsDiv; var dependantSpans = pluginMetadata.dependants; - infoContainer.update('
This plugin cannot be uninstalled
It has one or more plugins that depend on it.
'); + infoContainer.update('
' + i18n('cannot-uninstall') + '
' + i18n('installed-dependants') + '.
'); // Go through each dependant element. Show them all. for (var i = 0; i < dependantSpans.length; i++) { diff --git a/core/src/main/resources/hudson/PluginManager/installed.jelly b/core/src/main/resources/hudson/PluginManager/installed.jelly index 6b907852df..ed9435ba03 100644 --- a/core/src/main/resources/hudson/PluginManager/installed.jelly +++ b/core/src/main/resources/hudson/PluginManager/installed.jelly @@ -38,6 +38,14 @@ THE SOFTWARE.
+
diff --git a/war/src/main/webapp/css/style.css b/war/src/main/webapp/css/style.css index a2d66b17f1..2fae8e38c6 100644 --- a/war/src/main/webapp/css/style.css +++ b/war/src/main/webapp/css/style.css @@ -1770,3 +1770,7 @@ table#legend-table td { color: #f8f8f8; border: 1px solid #e39280; } + +.i18n { + display: none; +} \ No newline at end of file -- GitLab