예제 #1
0
        //patch over the GetTranslation method of I2 Localization
        public static bool Prefix(string Term, string overrideLanguage, ref string __result)
        {
            //abort translation if there is no term or the override language is english
            if (Term == null)
            {
                return(true);
            }
            if (overrideLanguage != null && overrideLanguage == "English")
            {
                return(true);
            }

            //look up translation in dictionary, default to English if there is none
            if (!TranslationRepository.Resolve(Term, out __result))
            {
                __result = I2.Loc.LocalizationManager.GetTranslation(Term, true, 0, true, false, null, "English");

                //show missing translations, skip non-translations
                if (string.IsNullOrWhiteSpace(__result))
                {
                    return(false);
                }
                if (__result == Term)
                {
                    return(false);
                }
                DiscoTranslator2.PluginLogger.LogInfo("Unknown term " + Term + ": " + __result);
            }

            return(false);
        }
예제 #2
0
 void OnTranslationChanged(object sender, FileSystemEventArgs e)
 {
     //reload translations
     Logger.LogMessage("Detected change in " + Path.GetFileName(e.FullPath));
     TranslationRepository.LoadTranslations();
 }
예제 #3
0
 public void Awake()
 {
     //load translations from translation directory
     TranslationRepository.LoadTranslations();
 }