Skip to content

Commit f7e3bb4

Browse files
authored
[T3CMS] Create convenience method to get locale (#350)
Related: #337
1 parent d3499ef commit f7e3bb4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

typo3-cms/src/main/java/com/cedricziel/idea/typo3/util/TranslationUtil.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public static StubTranslation findDefaultTranslationFromVariants(Project project
207207
}
208208

209209
// Try to find the one with the selected favorite locale
210-
String defaultLocale = (String) TYPO3CMSProjectSettings.getInstance(project).translationFoldingLocale;
210+
String defaultLocale = getTranslationFoldingLocale(project);
211211
if (defaultLocale != null && !defaultLocale.isEmpty()) {
212212
for (StubTranslation property : stubs) {
213213
if (property.getLanguage().equals(defaultLocale)) {
@@ -237,4 +237,10 @@ public static StubTranslation findDefaultTranslationFromVariants(Project project
237237

238238
return null;
239239
}
240+
241+
private static String getTranslationFoldingLocale(Project project) {
242+
String localeFromSettings = TYPO3CMSProjectSettings.getInstance(project).translationFoldingLocale;
243+
244+
return (String) localeFromSettings;
245+
}
240246
}

0 commit comments

Comments
 (0)