mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ResourceBundles: IgnoreUntranslatedLocales intention works incorrectly if default property file is missing (IDEA-146616)
This commit is contained in:
+1
@@ -251,6 +251,7 @@ public class PropertiesUtil {
|
||||
public static String getSuffix(@NotNull PropertiesFile propertiesFile) {
|
||||
final String baseName = propertiesFile.getResourceBundle().getBaseName();
|
||||
final String propertiesFileName = propertiesFile.getName();
|
||||
if (baseName.equals(FileUtil.getNameWithoutExtension(propertiesFileName))) return "";
|
||||
return FileUtil.getNameWithoutExtension(propertiesFileName.substring(baseName.length() + 1));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-4
@@ -66,7 +66,7 @@ public class IncompletePropertyInspection extends ResourceBundleEditorInspection
|
||||
mySuffixes.clear();
|
||||
final Element element = node.getChild(SUFFIXES_TAG_NAME);
|
||||
if (element != null) {
|
||||
mySuffixes.addAll(StringUtil.split(element.getText(), ","));
|
||||
mySuffixes.addAll(StringUtil.split(element.getText(), ",", true, false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,12 +185,10 @@ public class IncompletePropertyInspection extends ResourceBundleEditorInspection
|
||||
}
|
||||
|
||||
public List<PropertiesFile> getPropertiesFilesWithoutTranslation(final ResourceBundle resourceBundle, final String key) {
|
||||
final PropertiesFile defaultPropertiesFile = resourceBundle.getDefaultPropertiesFile();
|
||||
return ContainerUtil.filter(resourceBundle.getPropertiesFiles(), new Condition<PropertiesFile>() {
|
||||
@Override
|
||||
public boolean value(PropertiesFile propertiesFile) {
|
||||
return !defaultPropertiesFile.equals(propertiesFile) &&
|
||||
propertiesFile.findPropertyByKey(key) == null &&
|
||||
return propertiesFile.findPropertyByKey(key) == null &&
|
||||
!getIgnoredSuffixes().contains(PropertiesUtil.getSuffix(propertiesFile));
|
||||
}
|
||||
});
|
||||
|
||||
+7
-3
@@ -72,9 +72,13 @@ public class IncompletePropertyInspectionOptionsPanel {
|
||||
protected void customizeCellRenderer(JList list, String suffix, int index, boolean selected, boolean hasFocus) {
|
||||
append(suffix);
|
||||
final Locale locale = PropertiesUtil.getLocale("_" + suffix + ".properties");
|
||||
if (locale != PropertiesUtil.DEFAULT_LOCALE && PropertiesUtil.hasDefaultLanguage(locale)) {
|
||||
append(" ");
|
||||
append(PropertiesUtil.getPresentableLocale(locale), SimpleTextAttributes.GRAY_ATTRIBUTES);
|
||||
if (locale != PropertiesUtil.DEFAULT_LOCALE) {
|
||||
if (PropertiesUtil.hasDefaultLanguage(locale)) {
|
||||
append(" ");
|
||||
append(PropertiesUtil.getPresentableLocale(locale), SimpleTextAttributes.GRAY_ATTRIBUTES);
|
||||
}
|
||||
} else {
|
||||
append("Default locale");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user