Skip to content

Commit

Permalink
Standardise the messages for translations
Browse files Browse the repository at this point in the history
  • Loading branch information
me4502 committed Jun 15, 2019
1 parent f76a4c9 commit 1614def
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static void register(CommandRegistrationHandler registration,

private static Command createVertCommand(CommandManager commandManager) {
return commandManager.newCommand("vert")
.description(TranslatableComponent.of("worldedit.commands.expand.vert.description"))
.description(TranslatableComponent.of("worldedit.expand.description.vert"))
.action(parameters -> {
expandVert(
requireIV(Key.of(LocalSession.class), "localSession", parameters),
Expand All @@ -111,7 +111,7 @@ private static void expandVert(LocalSession session, Player player) throws Incom
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
int changeSize = newSize - oldSize;
player.printInfo(
TranslatableComponent.of(pluraliseI18n("worldedit.region.expanded.vert", changeSize), TextComponent.of(changeSize))
TranslatableComponent.of(pluraliseI18n("worldedit.expand.expanded.vert", changeSize), TextComponent.of(changeSize))
);
} catch (RegionOperationException e) {
player.printError(e.getMessage());
Expand Down Expand Up @@ -150,7 +150,7 @@ public void expand(Player player, LocalSession session,
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);

int changeSize = newSize - oldSize;
player.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.region.expanded", changeSize), TextComponent.of(changeSize)));
player.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.expand.expanded", changeSize), TextComponent.of(changeSize)));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@
import java.util.Optional;
import java.util.Set;

/**
* Handles translations for the plugin.
*
* These should be in the following format:
* plugin.component.message[.meta]*
*
* Where,
* plugin = worldedit
* component = The part of the plugin, eg expand
* message = A descriptor for which message, eg, expanded
* meta = Any extra information such as plural/singular (Can have none to infinite)
*/
public class TranslationManager {

private static final Gson gson = new GsonBuilder().create();
Expand Down
10 changes: 5 additions & 5 deletions worldedit-core/src/main/resources/lang/strings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"worldedit.commands.expand.vert.description": "Vertically expand the selection to world limits.",
"worldedit.region.expanded.singular": "Region expanded {0} block",
"worldedit.region.expanded.plural": "Region expanded {0} blocks",
"worldedit.region.expanded.vert.singular": "Region expanded {0} block [top-to-bottom].",
"worldedit.region.expanded.vert.plural": "Region expanded {0} blocks [top-to-bottom]."
"worldedit.expand.description.vert": "Vertically expand the selection to world limits.",
"worldedit.expand.expanded.singular": "Region expanded {0} block",
"worldedit.expand.expanded.plural": "Region expanded {0} blocks",
"worldedit.expand.expanded.vert.singular": "Region expanded {0} block [top-to-bottom].",
"worldedit.expand.expanded.vert.plural": "Region expanded {0} blocks [top-to-bottom]."
}

0 comments on commit 1614def

Please sign in to comment.