Exemple #1
0
        // this will return the langTo version of the EN phrase
        public string tran(string phraseIn, string lang)
        {
            string phraseEx;

            // ensure we have a valid lang, else assume en
            if (lang != "fr" && lang != "es" && lang != "pt")
            {
                return(phraseIn);
            }
            else
            {
                // this instantiates the translate object
                //Translate translate = new Translate();

                // grab the translated phrase
                JSON = v8server.translate(phraseIn, lang);
                List <LangParameters> langParameters = serializer.Deserialize <List <LangParameters> >(JSON);
                phraseEx = langParameters[0].phrase;
                // if there is no translated value...
                if (phraseEx == null || phraseEx.Length == 0)
                {
                    phraseEx = Translate.translatePhrase(phraseIn, lang);          // get one from MS Translator
                    JSON     = v8server.translateUpdate(phraseIn, lang, phraseEx); // update the translation table
                }
                return(phraseEx);
            }
        }