コード例 #1
0
        public void doTranslation(TranslationConfigurationSO selectedConfig)
        {
            List <int>         destLanguageIDs = new List <int>();
            GameTranslationSet set             = GameTranslationGetter.GetTranslaitonSetFromLanguageCode(selectedConfig.sourceLanguage.code);
            var           keysToTranslate      = set.getGroup(selectedConfig.translation_set_group).getDictionaryCopy();
            List <string> textsToTranslate     = new List <string>(keysToTranslate.Keys);

            //save all of our keys before requesting to transalate them, otherwise we can get errors
            var uploadAll = new SaveSetOfKeys(selectedConfig.sourceLanguage.id,
                                              keysToTranslate,
                                              selectedConfig.translation_set_group
                                              );

            doCall(uploadAll);

            selectedConfig.destinationLanguages.ForEach((TransfluentLanguage lang) => { destLanguageIDs.Add(lang.id); });
            Stopwatch sw = new Stopwatch();

            sw.Start();
            var translate = new OrderTranslation(selectedConfig.sourceLanguage.id,
                                                 target_languages: destLanguageIDs.ToArray(),
                                                 texts: textsToTranslate.ToArray(),
                                                 level: selectedConfig.QualityToRequest,
                                                 group_id: selectedConfig.translation_set_group,
                                                 comment: "Do not replace any strings that look like {0} or {1} as they are a part of formatted text -- ie Hello {0} will turn into Hello Alex or some other string "
                                                 );

            doCall(translate);
            Debug.Log("full request time:" + sw.Elapsed);
        }
コード例 #2
0
        private void saveMySourceText()
        {
            GameTranslationSet set = GameTranslationGetter.GetTranslaitonSetFromLanguageCode(_selectedConfig.sourceLanguage.code);
            var keysToTranslate    = set.getGroup(_selectedConfig.translation_set_group).getDictionaryCopy();

            //save all of our keys before requesting to transalate them, otherwise we can get errors
            var uploadAll = new SaveSetOfKeys(_selectedConfig.sourceLanguage.id,
                                              keysToTranslate,
                                              _selectedConfig.translation_set_group
                                              );

            doCall(uploadAll, saveMyDestinationLanguageText);
        }
コード例 #3
0
        private void saveMyDestinationLanguageText()
        {
            List <WebServiceParameters> requestsToSaveLocalStrings = new List <WebServiceParameters>();

            foreach (TransfluentLanguage lang in _selectedConfig.destinationLanguages)
            {
                GameTranslationSet set = GameTranslationGetter.GetTranslaitonSetFromLanguageCode(lang.code);
                if (set == null)
                {
                    continue;
                }
                var keysToTranslate = set.getGroup(_selectedConfig.translation_set_group).getDictionaryCopy();
                //save all of our keys before requesting to transalate them, otherwise we can get errors
                var uploadAll = new SaveSetOfKeys(lang.id,
                                                  keysToTranslate,
                                                  _selectedConfig.translation_set_group,
                                                  fork: true
                                                  );
                requestsToSaveLocalStrings.Add(uploadAll);
            }
            doCalls(requestsToSaveLocalStrings, ordermytranslation);
        }
コード例 #4
0
        public void doTranslation(TranslationConfigurationSO selectedConfig)
        {
            List<int> destLanguageIDs = new List<int>();
            GameTranslationSet set = GameTranslationGetter.GetTranslaitonSetFromLanguageCode(selectedConfig.sourceLanguage.code);
            var keysToTranslate = set.getGroup(selectedConfig.translation_set_group).getDictionaryCopy();
            List<string> textsToTranslate = new List<string>(keysToTranslate.Keys);

            //save all of our keys before requesting to transalate them, otherwise we can get errors
            var uploadAll = new SaveSetOfKeys(selectedConfig.sourceLanguage.id,
                keysToTranslate,
                selectedConfig.translation_set_group
                );
            doCall(uploadAll);

            selectedConfig.destinationLanguages.ForEach((TransfluentLanguage lang) => { destLanguageIDs.Add(lang.id); });
            Stopwatch sw = new Stopwatch();
            sw.Start();
            var translate = new OrderTranslation(selectedConfig.sourceLanguage.id,
                    target_languages: destLanguageIDs.ToArray(),
                    texts: textsToTranslate.ToArray(),
                    level: selectedConfig.QualityToRequest,
                    group_id: selectedConfig.translation_set_group,
                    comment: "Do not replace any strings that look like {0} or {1} as they are a part of formatted text -- ie Hello {0} will turn into Hello Alex or some other string "
                    );
            doCall(translate);
            Debug.Log("full request time:" + sw.Elapsed);
        }
コード例 #5
0
        private void saveMySourceText()
        {
            GameTranslationSet set = GameTranslationGetter.GetTranslaitonSetFromLanguageCode(_selectedConfig.sourceLanguage.code);
            var keysToTranslate = set.getGroup(_selectedConfig.translation_set_group).getDictionaryCopy();

            //save all of our keys before requesting to transalate them, otherwise we can get errors
            var uploadAll = new SaveSetOfKeys(_selectedConfig.sourceLanguage.id,
                keysToTranslate,
                _selectedConfig.translation_set_group
                );

            doCall(uploadAll, saveMyDestinationLanguageText);
        }
コード例 #6
0
        private void saveMyDestinationLanguageText()
        {
            List<WebServiceParameters> requestsToSaveLocalStrings = new List<WebServiceParameters>();

            foreach(TransfluentLanguage lang in _selectedConfig.destinationLanguages)
            {
                GameTranslationSet set = GameTranslationGetter.GetTranslaitonSetFromLanguageCode(lang.code);
                if(set == null)
                {
                    continue;
                }
                var keysToTranslate = set.getGroup(_selectedConfig.translation_set_group).getDictionaryCopy();
                //save all of our keys before requesting to transalate them, otherwise we can get errors
                var uploadAll = new SaveSetOfKeys(lang.id,
                    keysToTranslate,
                    _selectedConfig.translation_set_group,
                    fork:true
                    );
                requestsToSaveLocalStrings.Add(uploadAll);
            }
            doCalls(requestsToSaveLocalStrings, ordermytranslation);
        }