refactor(i18n): shorter keys

This commit is contained in:
ineanto 2023-06-29 11:13:16 +02:00
parent cb11f5e47a
commit 02e03794e4
5 changed files with 19 additions and 19 deletions

View file

@ -142,9 +142,9 @@ public class AppearanceManager {
}
return new ActionResult<>();
} catch (ExecutionException e) {
return new ActionResult<>(I18NDict.Error.SKIN_FAIL_CACHE);
return new ActionResult<>(I18NDict.Error.CACHE);
} catch (IOException e) {
return new ActionResult<>(I18NDict.Error.NAME_FAIL_MOJANG);
return new ActionResult<>(I18NDict.Error.MOJANG_NAME);
}
}
return new ActionResult<>();

View file

@ -24,11 +24,11 @@ public class I18NDict {
}
public static class Error {
public static final String UNEXPECTED_ERROR = "error.invalid_name";
public static final String PLAYER_OFFLINE = "error.player_offline";
public static final String SKIN_FAIL_MOJANG = "error.couldnt_get_skin_from_mojang";
public static final String SKIN_FAIL_CACHE = "error.couldnt_get_skin_from_cache";
public static final String NAME_FAIL_MOJANG = "error.couldnt_get_name_from_mojang";
public static final String GENERIC = "error.generic";
public static final String PLAYER_OFFLINE = "error.offline";
public static final String CACHE = "error.cache";
public static final String MOJANG_NAME = "error.mojang_name";
public static final String MOJANG_SKIN = "error.mojang_skin";
public static final String INVALID_USERNAME = "error.invalid_username";
public static final String SQL_ERROR = "error.sql";
public static final String JSON_ERROR = "error.json";

View file

@ -63,10 +63,10 @@ public class PlayerDataStore {
}
public ActionResult<Void> saveData(Player player) {
if (storage.isError()) return new ActionResult<>(I18NDict.Error.UNEXPECTED_ERROR);
if (!cache.isCached(player.getUniqueId())) return new ActionResult<>(I18NDict.Error.UNEXPECTED_ERROR);
if (storage.isError()) return new ActionResult<>(I18NDict.Error.GENERIC);
if (!cache.isCached(player.getUniqueId())) return new ActionResult<>(I18NDict.Error.GENERIC);
if (!cache.retrieve(player.getUniqueId()).isPresent())
return new ActionResult<>(I18NDict.Error.UNEXPECTED_ERROR);
return new ActionResult<>(I18NDict.Error.GENERIC);
// TODO (Ineanto, 5/20/23): Remove value from cache
//profiles.remove(player.getUniqueId());

View file

@ -1,10 +1,10 @@
error:
invalid_name: "Unable to get username from Mojang."
couldnt_get_skin_from_cache: "Unable to get skin from the cache."
couldnt_get_skin_from_mojang: "Unable to get skin from Mojang."
generic: "Unknown error"
invalid_username: "§cThis is not a valid Minecraft username."
player_offline: "§c{0} §fis offline!"
mojang_name: "Unable to get username from Mojang."
mojang_skin: "Unable to get skin from Mojang."
offline: "§c{0} §fis offline!"
cache: "Unable to get skin from the cache."
sql: "SQL Error"
json: "JSON Error"
event:

View file

@ -1,10 +1,10 @@
error:
couldnt_get_name_from_mojang: "Impossible de récupérer le nom d''utilisateur depuis Mojang."
couldnt_get_skin_from_cache: "Impossible de récupérer le skin depuis le cache."
couldnt_get_skin_from_mojang: "Impossible de récupérer le skin depuis Mojang."
generic: "Erreur inconnue"
generic: Erreur inconnue"
invalid_username: "§cLe pseudo n''est pas un pseudo Minecraft valide."
player_offline: "§c{0} §fest hors-ligne!."
mojang_name: "Impossible de récupérer le nom d''utilisateur depuis Mojang."
mojang_skin: "Impossible de récupérer le skin depuis Mojang."
offline: "§c{0} §fest hors-ligne!"
cache: "Impossible de récupérer le skin depuis le cache."
sql: "Erreur SQL"
json: "Erreur JSON"
event: