add path-prefix support

This commit is contained in:
Marcel Haßlinger 2021-09-19 22:01:42 +02:00
parent 3f09556d1d
commit c75a49cae0

View File

@ -29,7 +29,17 @@ public class KeyAnnotator {
}
String previewLocale = SettingsService.getInstance(project).getState().getPreviewLocale();
LocalizedNode node = DataStore.getInstance(project).getTranslations().getNode(key);
String pathPrefix = SettingsService.getInstance(project).getState().getPathPrefix();
String searchKey = key.length() >= pathPrefix.length()
? key.substring(pathPrefix.length())
: key;
if(searchKey.startsWith(".")) {
searchKey = searchKey.substring(1);
}
LocalizedNode node = DataStore.getInstance(project).getTranslations().getNode(searchKey);
if(node == null) { // Unknown translation. Just ignore it
return;