Example #1
0
        public string GetDayPeriod(string type, LocaleFieldSize width,
                                   LocaleFieldType compose = LocaleFieldType.Default)
        {
            LdmlNode dayPeriods = this.Select("dayPeriods");

            var node = dayPeriods.Select(new NodePathEntry("dayPeriodContext", compose.ToCode()));

            NodePathEntry[] path =
            {
                new NodePathEntry("dayPeriodWidth", width.ToCode()),
                new NodePathEntry("dayPeriod",      type)
            };
            foreach (int w in XUtil.GetClosest((int)width, (int)LocaleFieldSize.Wide))
            {
                path[0].Attributes[0].Value = ((LocaleFieldSize)w).ToCode();

                var rNode = node.Select(path);
                if (rNode != null)
                {
                    return(rNode.Value);
                }
            }
            //if ( compose == EntryCompose.StandAlone ) {
            //    return GetDayPeriod( type, width );
            //}
            return(null);
        }
Example #2
0
        public string[] GetMonths(LocaleFieldSize width, LocaleFieldType compose = LocaleFieldType.Default)
        {
            var root = this.Select(new NodePathEntry("months"),
                                   new NodePathEntry("monthContext", compose.ToCode()),
                                   new NodePathEntry("monthWidth", width.ToCode())
                                   );

            if (root == null)
            {
                return(null);
            }
            return(root.GetList("month", GetMonthIndex));
        }