示例#1
0
        static LEStringTableEditor()
        {
#if UNITY_EDITOR_OSX
            const int RTLD_NOW = 2;
            lebidiLibHandle = dlopen(Path.Combine(LESettings.FullRootDir, LEConstants.LEBidiOSXPath), RTLD_NOW);
            if (lebidiLibHandle == IntPtr.Zero)
            {
                throw new Exception(LEConstants.BidiSupportDllError);
            }

            getbidiHandle = dlsym(lebidiLibHandle, LEConstants.GetBidiHandle);
            if (getbidiHandle == IntPtr.Zero)
            {
                throw new Exception(LEConstants.BidiSupportGetFunctionHandleError);
            }
#endif
            // Load after scripts have been reloaded
            Load();

            if (!string.IsNullOrEmpty(LESettings.Instance.LastSelectedLocSet) &&
                AllLangsVisual.ContainsKey(LESettings.Instance.LastSelectedLocSet))
            {
                CurrentLanguage = LESettings.Instance.LastSelectedLocSet;
            }
            else if (AllLangsVisual.Count > 0)
            {
                CurrentLanguage = AllLangsVisual.Keys.ToArray()[0];
            }
        }
示例#2
0
        public static string GetLocString(string key, string defaultValue)
        {
            string result = defaultValue;

            if (!string.IsNullOrEmpty(CurrentLanguage) && AllLangsVisual.ContainsKey(CurrentLanguage))
            {
                AllLangsVisual[CurrentLanguage].TryGetValue(key, out result);
            }

            return(result);
        }
示例#3
0
        public static List <string> GetLangKeys()
        {
            List <string> keys = new List <string>();

            if (!string.IsNullOrEmpty(CurrentLanguage) && AllLangsVisual.ContainsKey(CurrentLanguage))
            {
                keys = AllLangsVisual[CurrentLanguage].Keys.ToList();
            }

            return(keys);
        }
示例#4
0
        public static void UpdateString(string lang, string key, string value)
        {
            string visKey   = GetPresentationFromCache(key);
            string visValue = Logical2Visual(value);

            Dbg.Assert(AllLangsVisual.ContainsKey(lang));
            Dbg.Assert(AllLangsVisual[lang].ContainsKey(visKey));

            Dbg.Assert(AllLangsLogical.ContainsKey(lang));
            Dbg.Assert(AllLangsLogical[lang].ContainsKey(key));

            AllLangsVisual[lang][visKey] = visValue;
            AllLangsLogical[lang][key]   = value;

            NeedsSave = true;
        }