mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Handle double single quotes from crowdin
This commit is contained in:
3 files changed
+12
-6
No files matched your search
@@ -210,14 +210,15 @@ public final class CarbonMessageSource implements IMessageSource<Audience, Strin
|
||||
}
|
||||
|
||||
private String forPlayer(final String key, final CarbonPlayer player) {
|
||||
if (player.locale() != null) {
|
||||
final var properties = this.locales.get(player.locale());
|
||||
final @Nullable Locale locale = player.locale();
|
||||
if (locale != null) {
|
||||
final var properties = this.locales.get(locale);
|
||||
|
||||
if (properties != null) {
|
||||
final var message = properties.getProperty(key);
|
||||
|
||||
if (message != null) {
|
||||
return message;
|
||||
return fixCrowdin(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -236,7 +237,7 @@ public final class CarbonMessageSource implements IMessageSource<Audience, Strin
|
||||
return key;
|
||||
}
|
||||
|
||||
return value;
|
||||
return fixCrowdin(value);
|
||||
}
|
||||
|
||||
return key;
|
||||
@@ -312,4 +313,11 @@ public final class CarbonMessageSource implements IMessageSource<Audience, Strin
|
||||
return Translator.parseLocale(localeString);
|
||||
}
|
||||
|
||||
// Crowdin exports single quotes as double quotes
|
||||
private static String fixCrowdin(final String s) {
|
||||
return s.replace("\\''", "$$$$$")
|
||||
.replace("''", "'")
|
||||
.replace("$$$$$", "''");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user