public Font getFontPerLanguage(LanguageEntry lang) { if (lang.hasCustomFont()) { return(lang.getCustomFont()); } return(defaultFont); }
public TMP_FontAsset getTextMeshFontPerLanguage(LanguageEntry lang) { if (lang.hasCustomTextMeshFont()) { return(lang.getCustomTextMeshFont()); } return(defaultTextMeshFont); }
public void initialise() { if (!initialised) { if (languagesSetup != null) { if (languagesSetup.getSupportedLanguagesAmount() > 0) { defaultLanguage = languagesSetup.getDefaultLanguage(); if (defaultLanguage == null) { defaultLanguage = languagesSetup.getLanguage(0); printDebugLog("The default language defined in the setup cannot be found. Fallback to the first language provided.", LogType.Error); } currentLanguage = defaultLanguage; retrieveSavedUserLanguageHandler = PlayerPrefsStoredLanguageHandlers.getLanguageFromPlayerPrefs; storeSavedUserLanguageHandler = PlayerPrefsStoredLanguageHandlers.saveLanguageOnPlayerPrefs; languagesSetup.warmUp(); if (storeLanguageOnUserPrefs) { loadSavedUserLang(); } initialised = true; } else { printDebugLog("No Languages defined in the Localisation Setup provided, make sure at least one language is supported. Skipping initialisation.", LogType.Error); } } else { printDebugLog("No Languages Setup provided, make sure to create and assign it. Skipping initialisation.", LogType.Error); } } }
public void setLanguage(LanguageEntry entry) { printDebugLog("Settings language to " + entry.getLanguage(), LogType.Log); currentLanguage = entry; if (storeLanguageOnUserPrefs) { if (storeSavedUserLanguageHandler != null) { var isoCode = LanguageUtils.getISOCodeFromLanguage(entry.getLanguage()); printDebugLog("Storing saved language in User Prefs: " + isoCode, LogType.Log); storeSavedUserLanguageHandler.Invoke(isoCode); } } if (OnLanguageChanged != null) { OnLanguageChanged(); } }