Esempio n. 1
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        /// <param name="environment"></param>
        /// <param name="textContent"></param>
        public void ManipulateTextResponse(IDictionary <string, object> environment, Interface.TextContent textContent)
        {
            var javaScriptLanguage = ExtractJavaScriptLanguage(environment);

            if (javaScriptLanguage != null)
            {
                switch (javaScriptLanguage)
                {
                case "en":      InjectResxProperties(textContent, "en-GB"); break;

                case "de":      InjectResxProperties(textContent, "de-DE"); break;

                case "fr":      InjectResxProperties(textContent, "fr-FR"); break;

                case "nl":      InjectResxProperties(textContent, "nl-NL"); break;

                case "pt-br":   InjectResxProperties(textContent, "pt-BR"); break;

                case "ru":      InjectResxProperties(textContent, "ru-RU"); break;

                case "tr":      InjectResxProperties(textContent, "tr-TR"); break;

                case "zh":      InjectResxProperties(textContent, "zh-CN"); break;
                    // Do not throw an exception if not known, someone might be doing their own strings file
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Injects VRS.$$.xyz strings built from the appropriate RESX file.
        /// </summary>
        /// <param name="content"></param>
        /// <param name="cultureName"></param>
        private void InjectResxProperties(Interface.TextContent textContent, string cultureName)
        {
            var resourceStrings = FetchResourceStrings(cultureName);

            if (resourceStrings != null)
            {
                var injectPoint = textContent.Content.IndexOf("    // [[ MARKER END SIMPLE STRINGS ]]");
                if (injectPoint != -1)
                {
                    textContent.Content = String.Format("{0}{1}{2}",
                                                        textContent.Content.Substring(0, injectPoint),
                                                        BuildLanguageStrings(resourceStrings),
                                                        textContent.Content.Substring(injectPoint)
                                                        );
                }
            }
        }