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

How to override portletName for TwinkleModule #19

Closed
Xi-Plus opened this issue Oct 14, 2021 · 2 comments
Closed

How to override portletName for TwinkleModule #19

Xi-Plus opened this issue Oct 14, 2021 · 2 comments

Comments

@Xi-Plus
Copy link
Collaborator

Xi-Plus commented Oct 14, 2021

I have override portletName in this way:
https://github.com/Xi-Plus/twinkle-zhwiktionary/blob/7582f78403302babe9cee5da635947dfe825376e/src/batchdelete.ts#L5
The text in the menu is still "D-batch".

export class BatchDelete extends BatchDeleteCore {
	portletName = '批刪';

doesn't work too.

@siddharthvp
Copy link
Member

Oh, you're right - it can't be changed because the core class defines the default and calls addMenu() in its constructor, so the derived class doesn't get a chance to change it.

@siddharthvp
Copy link
Member

Fixed in f5f485b by adding a beforeAddMenu() method to TwinkleModule class. Now you can do this by:

export class BatchDelete extends BatchDeleteCore {
	beforeAddMenu() {
		this.portletName = '...'; // or msg('...')
	}

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