示例#1
0
        //[MenuItem("Transfluent/test get content")]
        public static void getTestContent()
        {
            var list = ResourceLoadFacade.getLanguageList();
            GameTranslationSet source = GameTranslationGetter.GetTranslaitonSetFromLanguageCode("en-us");
            var sender   = new FileBasedSend();
            var contents = sender.SendFileContents(source.getGroup().getDictionaryCopy(), list.getLangaugeByCode("en-us"), "", "");

            Debug.Log("Contents :" + contents);
        }
示例#2
0
        //[MenuItem("Transfluent/test full loop english content")]
        public static void getTestSaveEnglishContent()
        {
            var list = ResourceLoadFacade.getLanguageList();
            GameTranslationSet source = GameTranslationGetter.GetTranslaitonSetFromLanguageCode("en-us");
            var sender   = new FileBasedSend();
            var contents = sender.SendFileContents(source.getGroup().getDictionaryCopy(), list.getLangaugeByCode("en-us"), "", "");

            Debug.Log("Contents :" + contents);

            TransfluentEditorWindowMediator mediator = new TransfluentEditorWindowMediator();

            mediator.doAuth();
            string authToken      = mediator.getCurrentAuthToken();
            string fileIdentifier = "testfile";
            var    sourceLang     = list.getLangaugeByCode("en-us");

            var saveCall     = new FileBasedSaveCall(fileIdentifier, sourceLang.id, authToken, contents);
            var caller       = new SyncronousEditorWebRequest();
            var returnStatus = caller.request(saveCall);

            Debug.Log("saved file return status:");
            Debug.Log(JsonWriter.Serialize(returnStatus));
            Debug.Log("auth token:" + authToken);
            var translateRequest = new FileTranslate("", new int[] { 3, 4 },
                                                     OrderTranslation.TranslationQuality.NATIVE_SPEAKER, fileIdentifier, sourceLang.id, authToken);
            var translateReturn = caller.request(translateRequest);

            Debug.Log("translate request file:");
            Debug.Log(JsonWriter.Serialize(translateReturn));

            var translateResultRequest = new FileBasedRead(fileIdentifier, sourceLang.id, authToken);
            var translateResultReturn  = caller.request(translateResultRequest);

            Debug.Log("translate resulting file:");
            Debug.Log(JsonWriter.Serialize(translateResultReturn));
        }
        //[MenuItem("Transfluent/test full loop english content")]
        public static void getTestSaveEnglishContent()
        {
            var list = ResourceLoadFacade.getLanguageList();
            GameTranslationSet source = GameTranslationGetter.GetTranslaitonSetFromLanguageCode("en-us");
            var sender = new FileBasedSend();
            var contents = sender.SendFileContents(source.getGroup().getDictionaryCopy(), list.getLangaugeByCode("en-us"), "", "");
            Debug.Log("Contents :" + contents);

            TransfluentEditorWindowMediator mediator = new TransfluentEditorWindowMediator();
            mediator.doAuth();
            string authToken = mediator.getCurrentAuthToken();
            string fileIdentifier = "testfile";
            var sourceLang = list.getLangaugeByCode("en-us");

            var saveCall = new FileBasedSaveCall(fileIdentifier, sourceLang.id, authToken, contents);
            var caller = new SyncronousEditorWebRequest();
            var returnStatus = caller.request(saveCall);

            Debug.Log("saved file return status:");
            Debug.Log(JsonWriter.Serialize(returnStatus));
            Debug.Log("auth token:" + authToken);
            var translateRequest = new FileTranslate("", new int[] { 3, 4 },
                OrderTranslation.TranslationQuality.NATIVE_SPEAKER, fileIdentifier, sourceLang.id, authToken);
            var translateReturn = caller.request(translateRequest);

            Debug.Log("translate request file:");
            Debug.Log(JsonWriter.Serialize(translateReturn));

            var translateResultRequest = new FileBasedRead(fileIdentifier, sourceLang.id, authToken);
            var translateResultReturn = caller.request(translateResultRequest);
            Debug.Log("translate resulting file:");
            Debug.Log(JsonWriter.Serialize(translateResultReturn));
        }
 //[MenuItem("Transfluent/test get content")]
 public static void getTestContent()
 {
     var list = ResourceLoadFacade.getLanguageList();
     GameTranslationSet source = GameTranslationGetter.GetTranslaitonSetFromLanguageCode("en-us");
     var sender = new FileBasedSend();
     var contents = sender.SendFileContents(source.getGroup().getDictionaryCopy(), list.getLangaugeByCode("en-us"), "", "");
     Debug.Log("Contents :" + contents);
 }