Ejemplo n.º 1
0
        private static void WriteCulture(string outputdir, string fileName, string extend, string global, CultureInfo culture, StringBuilder aggregateScript)
        {
            var globInfo = GlobalizationInfo.GetGlobInfo(culture);
            var diff     = (String.IsNullOrEmpty(extend) || culture == CultureInfo.InvariantCulture || culture.Name.Equals("en")) ? globInfo.ToDictionary(false) : GlobalizationInfo.DiffGlobInfos(GlobalizationInfo.BasisGlobInfo, globInfo.ToDictionary(true));
            var script   = GlobalizationInfo.GenerateJavaScript(extend, global, culture, culture.Name, diff, aggregateScript);
            var filePath = Path.Combine(outputdir, String.Format(fileName, (String.IsNullOrEmpty(culture.Name) ? "invariant" : culture.Name)));

            File.WriteAllText(filePath, script);
            Console.WriteLine(filePath);
            // minimize
            var    minScript = minifier.MinifyJavaScript(script, codeSettings);
            string minPath   = Path.ChangeExtension(filePath, "min.js");

            File.WriteAllText(minPath, minScript);
            Console.WriteLine(minPath);
        }
Ejemplo n.º 2
0
        private static void WriteCulture(string outputdir, string fileName, string extend, string global, CultureInfo culture, StringBuilder aggregateScript)
        {
            var globInfo = GlobalizationInfo.GetGlobInfo(culture);
            var diff     = (String.IsNullOrEmpty(extend) || culture == CultureInfo.InvariantCulture || culture.Name.Equals("en")) ? globInfo.ToDictionary(false) : GlobalizationInfo.DiffGlobInfos(GlobalizationInfo.BasisGlobInfo, globInfo.ToDictionary(true));

            // Fix for Issue #31 - en-US 'englishName' is wrong
            // Special case diff of englishName for en-US. The generator diff seemingly finds both "en" and "en-US" to
            // have englishName "English (United States)" but globalize.js (correctly) has the neutral "English" for "en"/"default"
            if (culture.Name.Equals("en-US"))
            {
                diff.Add("name", globInfo.name);
                diff.Add("englishName", globInfo.englishName);
            }

            var script   = GlobalizationInfo.GenerateJavaScript(extend, global, culture, culture.Name, diff, aggregateScript);
            var filePath = Path.Combine(outputdir, String.Format(fileName, (String.IsNullOrEmpty(culture.Name) ? "invariant" : culture.Name)));

            File.WriteAllText(filePath, script);
            Console.WriteLine(filePath);
        }