Display localized text
Get strings in the current display language from your registered source by key. When the language changes, listen for the event and redraw your UI.
Get a string
Section titled “Get a string”Call Get(sourceId, key, fallback) to get a string. In your tool, a small helper method that passes your SourceId is convenient.
public static string Get(string key, string fallback = null){ return EditorLocalization.Service.Get(SampleToolLocalization.SourceId, key, fallback);}Lookup order
Section titled “Lookup order”Get looks for the key in this order and returns the first match.
- The current language
- The source’s
DefaultLanguageCode en-US- The
fallbackargument, if given - The key string itself
If the source is not registered or its translation folder cannot be found, Get also returns the key string.
Follow language changes
Section titled “Follow language changes”When the language changes, the LanguageChanged event fires with the new language code. Subscribe only while your window is open, and redraw it when the event fires.
private void OnEnable(){ EditorLocalization.Service.LanguageChanged += OnLanguageChanged;}
private void OnDisable(){ EditorLocalization.Service.LanguageChanged -= OnLanguageChanged;}
private void OnLanguageChanged(string languageCode){ Repaint();}Find undefined keys
Section titled “Find undefined keys”Log messages start with [AMARI-LOC]. Warnings for undefined keys are off by default.
Set the EditorPrefs key com.amari-noa.unity-editor-localization-core.log-missing-keys to true to log a warning whenever an undefined key is requested without a fallback.
Copyright (c) 2026 天鈴のあ
