Esempio n. 1
0
        public TranslationIOUnit(EditorInternalConfig config, DefaultLocalizationRepository defaultLocalizationRepository, EditorTranslationIORepository editorTranslationRepository)
        {
            if (defaultLocalizationRepository == null)
            {
                throw new ArgumentNullException(nameof(DefaultLocalizationRepository));
            }

            if (editorTranslationRepository == null)
            {
                throw new ArgumentNullException(nameof(EditorTranslationIORepository));
            }

            if (config == null)
            {
                throw new ArgumentNullException(nameof(EditorInternalConfig));
            }

            this._defaultLocalizationRepository = defaultLocalizationRepository;
            this._editorTranslationRepository   = editorTranslationRepository;

            var exporterType = ReflectionHelper
                               .GetAllSubtypes(typeof(ITranslationExport))
                               .First(e => e.Name == config.TranslationExportProvider);

            this._translationExport = (ITranslationExport)Activator.CreateInstance(exporterType);

            var importerType = ReflectionHelper
                               .GetAllSubtypes(typeof(ITranslationImport))
                               .First(e => e.Name == config.TranslationImportProvider);

            this._translationImport = (ITranslationImport)Activator.CreateInstance(importerType);
        }
Esempio n. 2
0
        private void RepaintView()
        {
            LocalizationConfig   config         = this._configRepository.Get();
            EditorInternalConfig internalConfig = this._configRepository.GetInternalConfig();

            this._localizationConfigWindow.DefaultCulture     = config.DefaultCulture;
            this._localizationConfigWindow.SceneExcludePrefix = internalConfig.SceneExcludePrefix;
        }
Esempio n. 3
0
        public ScenesLocalizationProvider(EditorInternalConfig internalConfig)
        {
            if (internalConfig == null)
            {
                throw new NullReferenceException(nameof(EditorInternalConfig));
            }

            this._internalConfig = internalConfig;
        }
Esempio n. 4
0
        public void SaveConfig()
        {
            var newConfig = new LocalizationConfig
            {
                DefaultCulture = this._localizationConfigWindow.DefaultCulture
            };

            var newInternalConfig = new EditorInternalConfig
            {
                SceneExcludePrefix        = this._localizationConfigWindow.SceneExcludePrefix,
                TranslationExportProvider = this._localizationConfigWindow.SelectedExportProvider,
                TranslationImportProvider = this._localizationConfigWindow.SelectedImportProvider
            };

            this._configRepository.Save(newConfig);
            this._configRepository.SaveInternalConfig(newInternalConfig);

            this.RepaintView();
        }
Esempio n. 5
0
 public void SaveInternalConfig(EditorInternalConfig config)
 {
     PlayerPrefsHelper.SaveToPrefs(EditorInternalConfig.INTERNAL_LOCALIZATION_CONFIG, config);
 }