コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="T:SIL.FieldWorks.Common.Keyboarding.Linux.IcuLocale"/> class.
 /// </summary>
 public IcuLocale(string localeId)
 {
     Id           = localeId;
     CountryCode  = Icu.GetISO3Country(localeId);
     LanguageCode = Icu.GetISO3Language(localeId);
     LCID         = Icu.GetLCID(localeId);
 }
コード例 #2
0
        private void ProcessOneLayoutForLanguage(IntPtr configRegistry, ref XklConfigItem item,
                                                 ref XklConfigItem subitem, IntPtr data)
        {
            var           subitemIsNull = subitem.Parent.RefCount == IntPtr.Zero;
            XklConfigItem language      = (XklConfigItem)Marshal.PtrToStructure(data, typeof(XklConfigItem));
            var           description   = subitemIsNull ? item.Description :
                                          item.Description + " - " + subitem.Description;
            List <LayoutDescription> layouts;

            if (m_Layouts.ContainsKey(description))
            {
                layouts = m_Layouts[description];
            }
            else
            {
                layouts = new List <LayoutDescription>();
                m_Layouts[description] = layouts;
            }

            var newLayout = new LayoutDescription {
                LayoutId      = subitemIsNull ? item.Name : item.Name + "\t" + subitem.Name,
                Description   = description,
                LayoutVariant = subitemIsNull ? string.Empty : subitem.Description,
                LanguageCode  = language.Name
            };

            if (item.Short_Description.Length < 3)
            {
                // we have a two letter country code; need to find the three-letter one
                newLayout.CountryCode =
                    Icu.GetISO3Country(item.Short_Description + "_" + item.Name).ToUpper();
            }
            else
            {
                newLayout.CountryCode = item.Short_Description.ToUpper();
            }
            layouts.Add(newLayout);
        }