Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization of menus and quick selection of commands for execution. #102

Open
trdm opened this issue Dec 24, 2020 · 2 comments
Open

Localization of menus and quick selection of commands for execution. #102

trdm opened this issue Dec 24, 2020 · 2 comments

Comments

@trdm
Copy link

trdm commented Dec 24, 2020

My question is - have you thought about the possibility of localization? I mean the name of the menu items added by the "addItem" and "Editor.addMenu" commands.
How about adding "text_en" and / or "text_ru" to the "cfg" structure from "menu.addItem (cfg)" to build the menu according to N ++ settings?
Question 2 is it possible to overload "menu.addItem (cfg)" so that it would call some function "OnAddItemToMenu (menu, cfg)" after adding a menu item. This will allow you to build a list of "cfg" items and implement quick command selection and execution accordingly. Or do I have to refactor my scripts by wrapping "menu.addItem (cfg)" in a function?
What do you think?

@sieukrem
Copy link
Owner

  1. As I understand you want to localize the menu text. But I did not get the point how text_en which steps are necessary to make the localization. Maybe an example of cfg and next steps could help me to understand
  2. I like your idea to wrap the native API. I think It would open the possibility for others to extend the javascript API with functions and event emitters.

@trdm
Copy link
Author

trdm commented Dec 28, 2020

But I did not get the point how text_en which steps are necessary to make the localization. Maybe an example of cfg and next steps could help me to understand.

Let's take the default "cfg.text" - intended for English-speaking users. And "cfg.text_ru" is for Russian speakers. The "cfg.text_locale" construction - i.e. locale will indicate from which attribute to take the menu text.

var myMergeLinesIntoParagraphs = {
    text: "Combine lines into paragraphs\tCtrl+Shift+A", 
    text_ru: "Объедините строки в абзацы\tCtrl+Shift+A", 
    ctrl: true,
    shift: true,
    alt: false,
    key : 0x41, 
    cmd: MergeLinesIntoParagraphs	
}
vTextSubMenu.addItem(myMergeLinesIntoParagraphs);

And a refactoring request, in: Menu.addItem (); Change "addItem" to "addMenuItem" or add "addMenuItem" in API, otherwise it is difficult to search.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants