Пример #1
0
 private bool rejectStrItem(FallbackStrItem fsi)
 {
     if (fsi == null)
     {
         return(true);
     }
     if (fsi.strItem == null)
     {
         return(true);
     }
     if (fsi.strItem.Title.Trim().Length.Equals(0))
     {
         return(true);
     }
     return(false);
 }
Пример #2
0
        public FallbackStrItem this[byte lid, int sid]
        {
            get
            {
                FallbackStrItem fsi = new FallbackStrItem();

                if (group == 0)
                {
                    fsi.strItem = null;
                    fsi.fallback.Add(pjse.Localization.GetString("strContext")
                                     //+ ": " + pjse.Localization.GetString(parent.Context.ToString())
                                     );
                    return(fsi);
                }

                if (Wrapper != null)
                {
                    fsi.strItem = Wrapper[lid, sid];                     // try to find instance/lid/sid at scope
                    if (!this.rejectStrItem(fsi))
                    {
                        return(fsi);
                    }

                    if (lid != 1)
                    {
                        fsi.strItem = Wrapper[1, sid];                         // try to find instance/1/sid at scope
                        if (!this.rejectStrItem(fsi))
                        {
                            if (fsi.fallback.Count == 0)                             // ignore unless this is the first / only fallback
                            {
                                fsi.lidFallback = true;
                            }
                            return(fsi);
                        }
                    }
                }

                if (parent != null)
                {
                    if (group != parent.GlobalGroup)
                    {
                        if (group != parent.SemiGroup && SemiGlobalStr != null)
                        {
                            fsi = SemiGlobalStr[lid, sid];
                            if (!this.rejectStrItem(fsi))
                            {
                                if (fsi.fallback.Count == 0)
                                {
                                    fsi.fallback.Add(pjse.Localization.GetString("Fallback")
                                                     + ": " + pjse.Localization.GetString("SemiGlobal"));
                                }
                                return(fsi);
                            }
                        }

                        if (GlobalStr != null)
                        {
                            fsi = GlobalStr[lid, sid];
                            if (!this.rejectStrItem(fsi))
                            {
                                if (fsi.fallback.Count == 0)
                                {
                                    fsi.fallback.Add(pjse.Localization.GetString("Fallback")
                                                     + ": " + pjse.Localization.GetString("Global"));
                                }
                                return(fsi);
                            }
                        }
                    }
                }

                return(null);
            }
        }