Ejemplo n.º 1
0
 public virtual string GetKeyForComponent(Component component, DesignElement designType)
 {
     return(TranslationToolHelperWinClient.GetPropertyNameForComponent(component, designType));
 }
Ejemplo n.º 2
0
        private void AddTranslateBarItem(BarItemLinkCollection collection, BarManager manager)
        {
            var bi = new BarButtonItem(manager, "Translate");

            m_TranslateButtons.Add(bi);
            bi.ItemClick += TranslationBarItem_Click;
            bi.Tag        = collection;
            foreach (BarItemLink il in collection)
            {
                var action = il.Item.Tag as MenuAction;
                if (action != null)
                {
                    if (string.IsNullOrEmpty(il.Item.Name))
                    {
                        il.Item.Name = GetUniqueMenuName();
                    }
                    m_View.ExclusionsList.Add(il.Item, new ExclusionItem()
                    {
                        Resource = CommonResource.EidssMenu,
                        Disabled = false,
                        Keys     = new[] { action.ResourceKey },
                        Source   = ExclusionSource.MenuAction
                    });
                    var propName = TranslationToolHelperWinClient.GetPropertyNameForComponent(il.Item,
                                                                                              DesignElement.Caption);
                    string englishCaption;
                    if (action.ItemsStorage != null)
                    {
                        englishCaption = action.ItemsStorage.GetString(action.ResourceKey, null, Localizer.lngEn);
                    }
                    else
                    {
                        englishCaption = il.Caption;
                    }
                    if (m_View.ResourcesList.ContainsKey(propName))
                    {
                        m_View.ResourcesList[propName].EnglishText  = englishCaption;
                        m_View.ResourcesList[propName].ResourceName = CommonResource.EidssMenu.ToString();
                        m_View.ResourcesList[propName].SourceKey    = action.ResourceKey;
                        m_View.ResourcesList[propName].Value        = il.Caption;
                    }
                    else
                    {
                        m_View.ResourcesList.Add(propName, new ResourceValue()
                        {
                            EnglishText  = englishCaption,
                            ResourceName = CommonResource.EidssMenu.ToString(),
                            SourceKey    = action.ResourceKey,
                            Value        = il.Caption
                        });
                    }
                }
                var bsi = il.Item as BarSubItem;
                if (bsi == null)
                {
                    il.Item.Enabled = false;
                    continue;
                }
                AddTranslateBarItem(bsi.ItemLinks, manager);
            }
            collection.Add(bi);
        }