From c75a49cae0454d4673b0262a5df38c1629197cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Ha=C3=9Flinger?= Date: Sun, 19 Sep 2021 22:01:42 +0200 Subject: [PATCH] add path-prefix support --- .../de/marhali/easyi18n/editor/KeyAnnotator.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/marhali/easyi18n/editor/KeyAnnotator.java b/src/main/java/de/marhali/easyi18n/editor/KeyAnnotator.java index 3395133..baad8bb 100644 --- a/src/main/java/de/marhali/easyi18n/editor/KeyAnnotator.java +++ b/src/main/java/de/marhali/easyi18n/editor/KeyAnnotator.java @@ -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;