mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-07 11:10:14 +01:00
#293 Fix localized command losing its children
This commit is contained in:
parent
76e6d757da
commit
87f88cb32a
@ -62,7 +62,9 @@ public class HelpMessagesService implements Reloadable {
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.build();
|
CommandDescription localCommand = builder.build();
|
||||||
|
localCommand.getChildren().addAll(command.getChildren());
|
||||||
|
return localCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage(HelpMessage message) {
|
public String getMessage(HelpMessage message) {
|
||||||
|
@ -29,9 +29,10 @@ section:
|
|||||||
|
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
# You can translate the data for all commands using the below pattern.
|
# You can translate the data for all commands using the below pattern.
|
||||||
# So for example to translate /authme reload, create a section "authme.reload", or "login" for /login
|
# For example to translate /authme reload, create a section "authme.reload", or "login" for /login
|
||||||
# If the command has arguments, you can use arg1 as below to translate the first argument, and so forth
|
# If the command has arguments, you can use arg1 as below to translate the first argument, and so forth
|
||||||
# Translations don't need to be complete; any missing section will be taken from the default silently
|
# Translations don't need to be complete; any missing section will be taken from the default silently
|
||||||
|
# Important: Put main commands like "authme" before their children (e.g. "authme.reload")
|
||||||
commands:
|
commands:
|
||||||
authme.register:
|
authme.register:
|
||||||
description: 'Register a player'
|
description: 'Register a player'
|
||||||
|
@ -92,6 +92,20 @@ public class HelpMessagesServiceTest {
|
|||||||
assertThat(localCommand, sameInstance(command));
|
assertThat(localCommand, sameInstance(command));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldKeepChildrenInLocalCommand() {
|
||||||
|
// given
|
||||||
|
CommandDescription command = TestCommandsUtil.getCommandWithLabel(COMMANDS, "authme");
|
||||||
|
|
||||||
|
// when
|
||||||
|
CommandDescription localCommand = helpMessagesService.buildLocalizedDescription(command);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assertThat(localCommand.getChildren(), equalTo(command.getChildren()));
|
||||||
|
assertThat(localCommand.getDescription(), equalTo("authme cmd"));
|
||||||
|
assertThat(localCommand.getDetailedDescription(), equalTo("Main command"));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldGetTranslationsForSectionAndMessage() {
|
public void shouldGetTranslationsForSectionAndMessage() {
|
||||||
// given / when / then
|
// given / when / then
|
||||||
|
@ -7,6 +7,8 @@ section:
|
|||||||
arguments: 'arg.'
|
arguments: 'arg.'
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
authme:
|
||||||
|
detailedDescription: 'Main command'
|
||||||
authme.register:
|
authme.register:
|
||||||
description: 'Registration'
|
description: 'Registration'
|
||||||
detailedDescription: 'Registers the player'
|
detailedDescription: 'Registers the player'
|
||||||
|
Loading…
Reference in New Issue
Block a user