Ejemplo n.º 1
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
        {
            Translation translation = dataObject as Translation;

            if (translation == null)
            {
                return;
            }
            int    idx = translation.IsoCode.IndexOf('_');
            string language;
            string country;

            if (idx > 0)
            {
                language = translation.IsoCode.Substring(0, idx);
                country  = translation.IsoCode.Substring(idx + 1);
            }
            else
            {
                language = translation.IsoCode;
                country  = "";
            }

            if (IsoCodes.IsKnownLanguageCode(language))
            {
                if (IsoCodes.IsKnownCountryCode(country))
                {
                    nodeInfo.Label = IsoCodes.LookupLanguageCode(language).Name + "/" + IsoCodes.LookupCountryCode(country).Name + " (" + translation.IsoCode + ")";
                }
                else
                {
                    nodeInfo.Label = IsoCodes.LookupLanguageCode(language).Name + " (" + translation.IsoCode + ")";
                }
            }
            else
            {
                nodeInfo.Label = "(" + translation.IsoCode + ")";
            }
            nodeInfo.Icon = Context.GetIcon("md-po-file");
        }
Ejemplo n.º 2
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
        {
            Translation translation = dataObject as Translation;

            if (translation == null)
            {
                return;
            }
            int    idx = translation.IsoCode.IndexOf('_');
            string language;
            string country;

            if (idx > 0)
            {
                language = translation.IsoCode.Substring(0, idx);
                country  = translation.IsoCode.Substring(idx + 1);
            }
            else
            {
                language = translation.IsoCode;
                country  = "";
            }

            if (IsoCodes.IsKnownLanguageCode(language))
            {
                if (IsoCodes.IsKnownCountryCode(country))
                {
                    label = IsoCodes.LookupLanguageCode(language).Name + "/" + IsoCodes.LookupCountryCode(country).Name + " (" + translation.IsoCode + ")";
                }
                else
                {
                    label = IsoCodes.LookupLanguageCode(language).Name + " (" + translation.IsoCode + ")";
                }
            }
            else
            {
                label = "(" + translation.IsoCode + ")";
            }
            icon = Context.GetIcon("md-gettext-locale");
        }