Validate translation keys
Check for key mismatches between your translation files. The language in the source’s BaseLanguageCode is the base, and the target language’s file is compared against it.
Check the difference
Section titled “Check the difference”Call ValidateLanguageDiff(sourceId, targetLanguageCode). If targetLanguageCode is empty, the source’s DefaultLanguageCode is used as the target.
var result = EditorLocalization.Service.ValidateLanguageDiff(SampleToolLocalization.SourceId, "ja-JP");if (result.HasError){ foreach (var error in result.ParseErrors) Debug.LogError(error); return;}
foreach (var key in result.MissingKeys) Debug.LogWarning($"Missing: {key}");foreach (var key in result.ExtraKeys) Debug.LogWarning($"Extra: {key}");Read the result
Section titled “Read the result”The fields of the return value, EditorLocalizationValidationResult, are as follows.
| Field | Description |
|---|---|
SourceId |
The validated source. |
BaseLanguageCode |
The base language. |
TargetLanguageCode |
The target language. |
MissingKeys |
Keys in the base language that are missing from the target language. |
ExtraKeys |
Keys in the target language that are not in the base language. |
ParseErrors |
Load errors, such as a missing file or invalid JSON. |
HasError |
true if there is a load error or the source is not registered. Missing or extra keys alone do not set it. |
Copyright (c) 2026 天鈴のあ
