Example #1
0
 public override void ApplyResources(string cultureCode)
 {
     ResourcesList.Clear();
     EditableControlsList.Clear();
     foreach (GridColumn col in GridView.Columns)
     {
         string captionId = GetKeyForComponent(col, DesignElement.Caption);
         var    resValue  = CommonResourcesCache.Get("EidssFields", cultureCode, captionId, GetViewNameForSplittedResources());
         string propName  = TranslationToolHelper.GetPropertyName(col.Name, TranslationToolHelper.CaptionPropName);
         if (resValue != null && resValue.Value is string)
         {
             if (!ResourcesList.ContainsKey(propName))
             {
                 ResourcesList.Add(propName, resValue);
             }
             col.Caption = resValue.Value.ToString();
         }
         else
         {
             if (!ResourcesList.ContainsKey(propName))
             {
                 ResourcesList.Add(propName, new ResourceValue
                 {
                     Value = col.Caption,
                     //RawValue = col.Caption,
                     //SourceFileName = string.Format("EidssFields.{0}.resx", cultureCode),
                     EnglishText  = WinClientContext.FieldCaptions.GetString(captionId, null, common.Core.Localizer.lngEn),
                     SourceKey    = captionId,
                     ResourceName = CommonResource.EidssFields.ToString()
                 });
             }
         }
         EditableControlsList.Add(propName, col);
     }
 }
Example #2
0
        protected void Application_Start()
        {
            var connectionCredentials = new ConnectionCredentials();

            TranslationToolHelper.SetDefaultTranslationPath();
            DbManagerFactory.SetSqlFactory(connectionCredentials.ConnectionString);
            EidssUserContext.Init();
            CustomCultureHelper.CurrentCountry = EidssSiteContext.Instance.CountryID;

            EIDSS_LookupCacheHelper.Init();
            LookupCacheListener.Cleanup();
            LookupCacheListener.Listen();
            Localizer.MenuMessages = EidssMenu.Instance;

            ClassLoader.Init("eidss_db.dll", bv.common.Core.Utils.GetDesktopExecutingPath());

            //AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            InputBuilder.BootStrap();

            BaseFieldValidator.FieldCaptions = EidssFields.Instance;

            ModelBinders.Binders.DefaultBinder = new DevExpressEditorsBinder();

            SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
            XtraWebLocalizer.Activate();
        }
Example #3
0
        public override void ApplyResources(string cultureCode)
        {
            ResourcesList.Clear();
            foreach (Control ctl in Controls)
            {
                var action = ctl.Tag as ActionMetaItem;
                if (action != null)
                {
                    string s        = action.CaptionId(BusinessObject, Permissions);
                    var    resValue = CommonResourcesCache.Get(CommonResource.BvMessages.ToString(), cultureCode, s, GetViewNameForSplittedResources());
                    var    propName = TranslationToolHelper.GetPropertyName(ctl.Name, TranslationToolHelper.TextPropName);
                    if (resValue == null && Messages != null)
                    {
                        resValue = CommonResourcesCache.Get(Messages.GetType().Name, cultureCode, s, GetViewNameForSplittedResources());
                    }
                    if (resValue != null)
                    {
                        ResourcesList.Add(propName, resValue);
                        ctl.Text = resValue.Value.ToString();

                        if (!EditableControlsList.ContainsKey(propName))
                        {
                            EditableControlsList.Add(propName, ctl);
                        }
                    }
                }
                else if (BasePanel != null && !(ctl is TranslationButton))
                {
                    TranslationToolHelperWinClient.ApplyResources(ctl, BasePanel as ITranslationView, cultureCode);
                }
            }
        }
Example #4
0
 private static string MakeDefaultPath(string sourceName)
 {
     if (!g_dirsRes.ContainsKey(sourceName))
     {
         g_dirsRes.Add(sourceName, TranslationToolHelper.GetFullPathToResX(sourceName, null));
     }
     return(string.IsNullOrEmpty(g_dirsRes[sourceName]) ? null : g_dirsRes[sourceName]);
     //string root = Utils.GetExecutingPath();
     //string dir = g_dirsRes[sourceName];
     //return string.Format("{0}{1}{2}.resx", root, dir, sourceName);
 }
 private static void InitResources(string resourceName, string cultureCode)
 {
     if (cultureCode != null && !m_CultureCode.Equals(cultureCode))
     {
         m_CultureCode = cultureCode;
         m_CommonResources.Clear();
     }
     if (!m_CommonResources.ContainsKey(resourceName))
     {
         var resValues = new Dictionary <string, ResourceValue>();
         TranslationToolHelper.ReadResxFile(resourceName, cultureCode, resValues, null);
         m_CommonResources.Add(resourceName, resValues);
     }
 }
Example #6
0
        //{
        //    {"BvMessages", @"App_Data\Translations\Resources\EIDSSTrunk\EIDSS\bv.common\Resources\"},
        //    {"XtraStrings", @"App_Data\Translations\Resources\EIDSSTrunk\EIDSS\bv.common\Resources\"},
        //    {"EidssFields", @"App_Data\Translations\Resources\EIDSSTrunk\EIDSS\eidss.core\Resources\"},
        //    {"EidssMenu", @"App_Data\Translations\Resources\EIDSSTrunk\EIDSS\eidss.core\Resources\"},
        //    {"EidssMessages", @"App_Data\Translations\Resources\EIDSSTrunk\EIDSS\eidss.core\Resources\"}
        //};
        private static string MakePath(string sourceName, CultureInfo ci)
        {
            var key = string.Join(".", sourceName, ci.Name);

            if (!g_dirsRes.ContainsKey(key))
            {
                g_dirsRes.Add(key, TranslationToolHelper.GetFullPathToResX(sourceName, ci.Name));
            }
            return(string.IsNullOrEmpty(g_dirsRes[key]) ? null : g_dirsRes[key]);

            //string root = Utils.GetExecutingPath();
            //string dir = g_dirsRes[sourceName];
            //return string.Format("{0}{1}{2}.{3}.resx", root, dir, sourceName, ci.Name);
        }
Example #7
0
        public override void ApplyResources(string cultureCode)
        {
            base.ApplyResources(cultureCode);
            var resValues = TranslationToolHelper.ReadResxFile(ParentBasePanel.GetType().Name, cultureCode,
                                                               null, null);

            if (resValues.ContainsKey("$this.Caption"))
            {
                CaptionLabel.Text = resValues["$this.Caption"].Value.ToString();
                if (!EditableControlsList.ContainsKey("$this.Caption"))
                {
                    EditableControlsList.Add("$this.Caption", this);
                }
            }
        }
 public static string GetText(string resourceName, string cultureCode, string key, bool returnDefaultValue = false)
 {
     lock (m_CommonResources)
     {
         InitResources(resourceName, cultureCode);
         string result = null;
         if (m_CommonResources[resourceName].ContainsKey(key))
         {
             if (m_CommonResources[resourceName][key].Value != null)
             {
                 result = m_CommonResources[resourceName][key].Value.ToString();
             }
         }
         if (returnDefaultValue && string.IsNullOrEmpty(result))
         {
             result = TranslationToolHelper.GetDefaultText(resourceName, key);
         }
         return(result);
     }
 }