File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
main/java/com/rexcantor64/triton/language/parser
test/java/com/rexcantor64/triton/language/parser Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 55import com .rexcantor64 .triton .api .language .Localized ;
66import com .rexcantor64 .triton .utils .ComponentUtils ;
77import com .rexcantor64 .triton .utils .ParserUtils ;
8+ import com .rexcantor64 .triton .utils .StringUtils ;
89import lombok .AccessLevel ;
910import lombok .Getter ;
1011import lombok .Setter ;
@@ -217,6 +218,9 @@ TranslationResult<SerializedComponent> translateComponent(
217218 }
218219 key = ParserUtils .normalizeTranslationKey (key , configuration );
219220 key = stripFormatting (key );
221+ if (!StringUtils .isEmptyOrNull (configuration .getDisabledLine ()) && configuration .getDisabledLine ().equals (key )) {
222+ return Optional .empty ();
223+ }
220224
221225 val result = configuration .translationSupplier .apply (key , arguments );
222226
Original file line number Diff line number Diff line change @@ -432,4 +432,13 @@ public void testParseComponentWithPatterns() {
432432 assertNotNull (result .getResultRaw ());
433433 assertEquals (expected .compact (), result .getResultRaw ().compact ());
434434 }
435+
436+ @ Test
437+ public void testParseComponentWithDisabledLine () {
438+ Component comp = Component .text ("[lang]disabled.line[/lang]" );
439+
440+ TranslationResult <SerializedComponent > result = parser .translateComponent (new SerializedComponent (comp ), configuration );
441+
442+ assertEquals (TranslationResult .ResultState .TO_REMOVE , result .getState ());
443+ }
435444}
You can’t perform that action at this time.
0 commit comments