Jump to content

change the hints of TUniHTMLMemo


Mohammed Nasman

Recommended Posts

Hi All,

 

   Can I change the hints that shown on the TUniHTMLMemo tool bar, as attached image?

 

If I want to change the text of Font Color to another thing?

 

What I want to do to be able to translate the text of these hints, because I'm developing multi lang app using TsiLang, and I was not able to access to these strings.

 

Regards,

post-1329-0-26106800-1509378672_thumb.png

Link to comment
Share on other sites

Hi,

 

One of the possible solutions,

 

Can you try to use this approach for now ?!:

 

1. MainForm -> Script:

changeLang2HtmlMemo = function(htmlMemo, url, lang) {
    Ext.Loader.loadScript({
        url: "/ext-" + url + "/locale/ext-lang-" + lang + ".js",
        onLoad: function() {
            var me = htmlMemo;

            var i = 0;
            me.toolbar.items.items.forEach(function(item) {
                if (item.hasOwnProperty('tooltip')) {
                    item.setTooltip(me.buttonTips[item.itemId]);

                    me.toolbar.items.map[item.itemId] = item;
                    if (me.toolbar.items.map[item.itemId].overflowClone) {
                        me.toolbar.items.map[item.itemId].setTooltip(me.buttonTips[item.itemId]);
                    };
                    me.toolbar.initialConfig.items[i].text = me.buttonTips[item.itemId].text;
                    me.toolbar.initialConfig.items[i].tooltip.title = me.buttonTips[item.itemId].title;
                    me.toolbar.initialConfig.items[i].tooltip.text = me.buttonTips[item.itemId].text;
                    i++;
                } else {
                    i++
                }
            });

            var menu = Ext.getCmp(me.toolbar.id + '-menu-trigger').menu;
            if (menu) {
                if (!menu.hidden) {
                    menu.hide();
                    Ext.defer(function() {
                        menu.show();
                    }, 100)
                }
            }
        }
    })
}

2. How to use, for example:

uses .. ServerModule;

procedure TMainForm.UniButton1Click(Sender: TObject);
var
  Lang: string;
begin
  Lang := 'fr'; 
  UniSession.AddJS('changeLang2HtmlMemo('+UniHTMLMemo1.JSName+',"'
                                         +UniServerModule.ExtJSVersion+'","'
                                         +Lang+
                                       '")'
  );
end;

** "available languages", you can find in the folder "...\FMSoft\Framework\uniGUI\ext-[version]\locale\"

for example:

ext-lang-fr.js -> 'fr'
ext-lang-ru.js -> 'ru'

Try,

Best regards,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...