Skip to content

Commit

Permalink
Fix/unlocalised message and user again (#180)
Browse files Browse the repository at this point in the history
* Remove name localization

* Bump version

* Make locale codes more flexible
  • Loading branch information
rainbowdashlabs authored Jan 17, 2024
1 parent 9147d15 commit c618ba2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ license {
}

group = "de.chojo"
version = "2.9.1+beta.19"
version = "2.9.2+beta.19"
description = "Discord utilities for use with JDA"

publishData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public CommandData toCommandData(ILocalizer localizer) {
.setDefaultPermissions(meta.permission())
.setDefaultPermissions(meta.permission());
if (meta.localized()) {
message.setNameLocalizations(localizer.prefixedLocalizer("message").apply(localeKey()))
.setLocalizationFunction(localizer.prefixedLocalizer("message"));
message.setLocalizationFunction(localizer.prefixedLocalizer("message"));
}
return message;
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/de/chojo/jdautil/interactions/user/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public CommandData toCommandData(ILocalizer localizer) {
.setGuildOnly(meta.isGuildOnly())
.setDefaultPermissions(meta.permission());
if (meta.localized()) {
user.setNameLocalizations(localizer.prefixedLocalizer("user").apply(localeKey()))
.setLocalizationFunction(localizer.prefixedLocalizer("user"));
user.setLocalizationFunction(localizer.prefixedLocalizer("user"));
}
return user;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/chojo/jdautil/localization/Localizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

public class Localizer implements ILocalizer {
private final Pattern EMBEDDED_CODE;
private static final Pattern SIMPLE__CODE = Pattern.compile("^([a-zA-Z]+?\\.[a-zA-Z.]+)$");
private static final Pattern SIMPLE__CODE = Pattern.compile("^([a-zA-Z_]+?\\.[a-zA-Z_.]+)$");
private static final Logger log = getLogger(Localizer.class);
private final Map<DiscordLocale, ResourceBundle> languages;
private final Function<Guild, Optional<DiscordLocale>> languageProvider;
Expand All @@ -40,7 +40,7 @@ public Localizer(Map<DiscordLocale, ResourceBundle> languages, Function<Guild, O
this.languages = languages;
this.languageProvider = languageProvider;
this.defaultLanguage = defaultLanguage;
EMBEDDED_CODE = Pattern.compile("%s([a-zA-Z.]+?)%s".formatted(embedCodeStart, embedCodeEnd));
EMBEDDED_CODE = Pattern.compile("%s([a-zA-Z._]+?)%s".formatted(embedCodeStart, embedCodeEnd));
}

public static Builder builder(DiscordLocale defaultLanguage) {
Expand Down

0 comments on commit c618ba2

Please sign in to comment.