Skip to content

Commit

Permalink
Use en locale and include core fix for help text (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonesbusy authored Jul 11, 2024
1 parent 6ac933b commit 4e20f31
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<properties>
<changelist>999999-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/locale-plugin</gitHubRepo>
<jenkins.version>2.452.1</jenkins.version>
<jenkins.version>2.452.3</jenkins.version>
<configuration-as-code.version>1810.v9b_c30a_249a_4c</configuration-as-code.version>
<spotless.check.skip>false</spotless.check.skip>
</properties>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/hudson/plugins/locale/PluginImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class PluginImpl extends GlobalConfiguration {

// Set of allowed locales
private static final Set<String> ALLOWED_LOCALES = new HashSet<>(Arrays.asList(
"bg", "ca", "cs", "da", "de", "el", "en_GB", "es", "es_AR", "et", "fi", "fr", "he", "hu", "it", "ja", "ko",
"bg", "ca", "cs", "da", "de", "el", "en", "es", "es_AR", "et", "fi", "fr", "he", "hu", "it", "ja", "ko",
"lt", "lv", "nb_NO", "nl", "pl", "pt_BR", "pt_PT", "ro", "ru", "sk", "sl", "sr", "sv_SE", "tr", "uk",
"zh_CN", "zh_TW"));

Expand Down Expand Up @@ -170,9 +170,9 @@ public GlobalConfigurationCategory getCategory() {
public ListBoxModel doFillSystemLocaleItems() {
ListBoxModel items = new ListBoxModel();

// Use originalLocale to display the "Use Browser Locale" option
// Use originalLocale to display the "Use Default Locale" option
String originalLocaleDisplay = String.format(
"Use Browser Locale - %s (%s)", originalLocale.getDisplayName(), originalLocale.toString());
"Use Default Locale - %s (%s)", originalLocale.getDisplayName(), originalLocale.toString());
items.add(new ListBoxModel.Option(originalLocaleDisplay, USE_BROWSER_LOCALE));

Locale[] availableLocales = Locale.getAvailableLocales();
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/hudson/plugins/locale/PluginImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void setUp() {

// Set of allowed locales for the test
private static final Set<String> ALLOWED_LOCALES = new HashSet<>(Arrays.asList(
"bg", "ca", "cs", "da", "de", "el", "en_GB", "es", "es_AR", "et", "fi", "fr", "he", "hu", "it", "ja", "ko",
"bg", "ca", "cs", "da", "de", "el", "en", "es", "es_AR", "et", "fi", "fr", "he", "hu", "it", "ja", "ko",
"lt", "lv", "nb_NO", "nl", "pl", "pt_BR", "pt_PT", "ro", "ru", "sk", "sl", "sr", "sv_SE", "tr", "uk",
"zh_CN", "zh_TW"));

Expand All @@ -38,24 +38,24 @@ public void testDoFillSystemLocaleItems() {
ListBoxModel model = plugin.doFillSystemLocaleItems();

// Expected size of the ListBoxModel
int expectedSize = ALLOWED_LOCALES.size() + 1; // +1 for the "Use Browser Locale" option
int expectedSize = ALLOWED_LOCALES.size() + 1; // +1 for the "Use Default Locale" option

// Verify the returned ListBoxModel size
assertEquals("The returned ListBoxModel size is not as expected", expectedSize, model.size());

// Verify that the first option is "Use Browser Locale"
// Verify that the first option is "Use Default Locale"
String expectedFirstOption = String.format(
"Use Browser Locale - %s (%s)",
"Use Default Locale - %s (%s)",
Locale.getDefault().getDisplayName(), Locale.getDefault().toString());
assertEquals("The first option should be 'Use Browser Locale'", expectedFirstOption, model.get(0).name);
assertEquals("The first option should be 'Use Default Locale'", expectedFirstOption, model.get(0).name);

// Verify that the allowed locales are correctly added to the ListBoxModel, excluding the first option
for (String localeStr : ALLOWED_LOCALES) {
Locale locale = Locale.forLanguageTag(localeStr.replace('_', '-'));
String expectedOption = String.format("%s - %s", locale.getDisplayName(), locale.toString());

boolean found = false;
for (int i = 1; i < model.size(); i++) { // Start from 1 to skip the "Use Browser Locale" option
for (int i = 1; i < model.size(); i++) { // Start from 1 to skip the "Use Default Locale" option
if (model.get(i).name.equals(expectedOption)) {
found = true;
break;
Expand Down

0 comments on commit 4e20f31

Please sign in to comment.