It’s easy to have an existing editor support multiple languages.
Just change EditorWindow
to LocalizationEditorWindow
Then load the language file when the editor is initialized, such as the On_Enable
function to load the language file, it will automatically call InitLanguageInfo
.
If the language file is not in On_Enable
function load, remember to call the InitLanguageInfo
function after loading.
The InitLanguageInfo
function will load the language in the language information (if any) and restore the language set in the last closed window.
Simple On_Enable
example:
public class TestWindow : LocalizationEditorWindow
{
protected override void On_Enable()
{
//Load language file
LoadLanguageConfig("LanguageFolderPath", new CsvLocalizationCreateAndParse(), 1);
//Load the language file using the CsvLocalizationCreateAndParse parser
LoadCsvLanguageConfig("LanguageFolderPath",1);
}
}
Simple Init
example:
public class TestWindow : LocalizationEditorWindow
{
//Custom function
void Init()
{
//Load language file
LoadLanguageConfig("LanguageFolderPath", new CsvLocalizationCreateAndParse(), 1);
//Load the language file using the CsvLocalizationCreateAndParse parser
LoadCsvLanguageConfig("LanguageFolderPath",1);
//Initialize language information
InitLanguageInfo();
}
}