public void ordermytranslation()
        {
            //just queue up all the calls until first real stopping point
            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);

            _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 ",
                    fork: true
                    );
            doCall(translate, () =>
            {
                Debug.Log("ORDER DONE");
                _orderDone = true; EditorUtility.DisplayDialog("Success", "Transltion order complete!", "OK");
            });
        }
Ejemplo n.º 2
0
        public void ordermytranslation()
        {
            //just queue up all the calls until first real stopping point
            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);

            _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 ",
                                                 fork: true
                                                 );

            doCall(translate, () =>
            {
                Debug.Log("ORDER DONE");
                _orderDone = true; EditorUtility.DisplayDialog("Success", "Transltion order complete!", "OK");
            });
        }
Ejemplo n.º 3
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);
        }
        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);
        }
Ejemplo n.º 5
0
 public FileTranslate(string comment, int[] target_languages, OrderTranslation.TranslationQuality quality,
     string file_identifier_should_be_group_id, int sourceLanguage, string token)
 {
     postParameters.Add("ignore_me", "ignoreme");
     getParameters.Add("callback_url", "http://www.yahoo.com");
     getParameters.Add("comment", comment);
     getParameters.Add("level", ((int)quality).ToString());
     getParameters.Add("identifier", file_identifier_should_be_group_id);
     getParameters.Add("language", sourceLanguage.ToString());
     getParameters.Add("token", token);
     getParameters.Add("target_languages", JsonWriter.Serialize(target_languages));
 }