/// <summary>
        ///     Initialize the Translator for later use in the application
        /// </summary>
        /// <param name="languageName">Language to use for initialization</param>
        public void InitTranslator(string languageName)
        {
            LanguageLoader = BuildLanguageLoader();

            if (string.IsNullOrEmpty(languageName))
            {
                languageName = "english";
            }

            var translationFile = LanguageLoader.GetTranslationFile(languageName);

            var translator = BuildLanguageTranslator(translationFile);
            var fallback   = BuildLanguageTranslator(Path.Combine(LanguageLoader.TranslationFolder, "english.ini"));

            _translationProxy.Translator = new FallbackTranslator(translator, fallback);
        }
Beispiel #2
0
        /// <summary>
        /// Initialize the Translator for later use in the application
        /// </summary>
        /// <param name="assemblyHelper">AssemblyHelper that is used to determine the application folder</param>
        /// <param name="languageName">Language to use for initialization</param>
        public void InitTranslator(string languageName, IAssemblyHelper assemblyHelper = null)
        {
            if (assemblyHelper != null)
            {
                _assemblyHelper = assemblyHelper;
            }
            LanguageLoader = BuildLanguageLoader();

            if (string.IsNullOrEmpty(languageName))
            {
                languageName = "english";
            }

            string translationFile = LanguageLoader.GetTranslationFile(languageName);

            _translator = BuildLanguageTranslator(translationFile);
            _translator.FallbackTranslator = BuildLanguageTranslator(Path.Combine(TranslationPath, "english.ini"));

            UserGuideHelper.SetLanguage(languageName);
        }