예제 #1
0
            public void RefreshText(SystemLanguage language = SystemLanguage.Unknown)
            {
                if (language == SystemLanguage.Unknown)
                {
                    language = Localisation.GetCurrentLanguage();
                }

                if (_cachedLanguage != language || Localisation.AreGlobalVariablesOutOfDate(_cachedGlobalVariables)
#if UNITY_EDITOR
                    || !Application.isPlaying
#endif
                    )
                {
                    UpdateText(language);
                }
            }
예제 #2
0
            public string GetLocalisedString()
            {
                if (_cachedLanguage != Localisation.GetCurrentLanguage() || Localisation.AreGlobalVariablesOutOfDate(_cachedVariables)
#if UNITY_EDITOR
                    || !Application.isPlaying
#endif
                    )
                {
                    if (_localVariables != null && _localVariables.Length > 0)
                    {
                        _cachedText = Localisation.Get(_localisationKey, _localVariables);
                    }
                    else
                    {
                        _cachedText = Localisation.Get(_localisationKey);
                    }

                    _cachedLanguage  = Localisation.GetCurrentLanguage();
                    _cachedVariables = Localisation.GetGlobalVariables(_cachedText);
                }

                return(_cachedText);
            }
예제 #3
0
            public string GetLocalisedString(params LocalisationLocalVariable[] variables)
            {
                if (variables.Length > 0 || _cachedLanguage != Localisation.GetCurrentLanguage() || Localisation.AreGlobalVariablesOutOfDate(_cachedVariables))
                {
                    _cachedLanguage  = Localisation.GetCurrentLanguage();
                    _cachedText      = Localisation.Get(_localisationKey, variables);
                    _cachedVariables = Localisation.GetGlobalVariables(_cachedText);
                }

                return(_cachedText);
            }