protected override void LoadDefaultMessages() { lang.RegisterMessages( new…
- User
protected override void LoadDefaultMessages() { lang.RegisterMessages( new Dictionary<string, string> { ["NoPermission"] = "You don't have permission to use this command.", ["NoBuildingAuth"] = "You must have building auth to use this.", ["NoFundation"] = "Must be placed on a foundation.", ["QuarryLimitReached"] = "Quarry Limit Reached.", ["NotMiningQuarry"] = "This object is not a Mining Quarry.", ["NotOwner"] = "This object belongs to another player.", ["QuarryRemoved"] = "Mining Quarry removed.", ["NoQuarriesFound"] = "No quarries found.", ["QuarrySend"] = "You have sent a Mining Quarry to the player.", ["QuarryReceived"] = "You have received a Mining Quarry.", ["QuarryDropped"] = "No space in inventory! Quarry dropped on the ground.", ["PlayerNotFound"] = "Player not found.", ["TurnedOn"] = "Quarry turned on.", ["AlreadyOn"] = "The Quarry is already on.", ["NoFuel"] = "Not enough fuel to start extraction.", ["NoSpace"] = "Not enough space in output for extracted resources.", ["NotEmpty"] = "The Quarry still contains items. Empty it before removal.", ["UpgradeRequirements"] = "You do not have the required items to upgrade.", ["QuarryTurnedOn"] = "Quarry turned on.", ["QuarryStopped"] = "Quarry stopped.", ["ExtractionIntervalText"] = "Extraction Interval: {0} seconds | Fuel per extraction: {1} {2}", ["StartButton"] = "Start", ["StopButton"] = "Stop", ["RemoveButton"] = "Remove", ["UpgradeButton"] = "Upgrade", ["UpgradeToLevel"] = "Upgrade to Level {0}", ["StorageHeader"] = "Storage", ["FuelSlots"] = "Fuel: {0} slots", ["ResourceSlots"] = "Resource: {0} slots", ["ExtractionHeader"] = "Extraction", ["RequirementsHeader"] = "Requirements", ["YesButton"] = "Yes", ["NoButton"] = "No", ["ConfirmRemove"] = "Remove the Quarry?", ["ConfirmUpgrade"] = "Upgrade the Quarry?", ["QuarryLevel"] = "Quarry Level {0}", }, this );
lang.RegisterMessages( new Dictionary<string, string> { ["NoPermission"] = "Você não tem permissão.", ["NoBuildingAuth"] = "Você precisa de permissão para construir.", ["NoFundation"] = "Deve ser colocado em uma fundação.", ["QuarryLimitReached"] = "Limite de Quarries alcançado.", ["NotMiningQuarry"] = "Este não é uma Quarry.", ["NotOwner"] = "Isto pertence a outro jogador.", ["QuarryRemoved"] = "Quarry removida.", ["NoQuarriesFound"] = "Nenhuma Quarry encontrada.", ["QuarrySend"] = "Quarry enviada ao jogador.", ["QuarryReceived"] = "Você recebeu uma Quarry.", ["QuarryDropped"] = "Inventário cheio! Quarry no chão.", ["PlayerNotFound"] = "Jogador não encontrado.", ["TurnedOn"] = "Quarry ligada.", ["AlreadyOn"] = "A Quarry já está ligada.", ["NoFuel"] = "Combustível insuficiente.", ["NoSpace"] = "Espaço insuficiente para recursos.", ["NotEmpty"] = "Esvazie a Quarry antes de remover.", ["UpgradeRequirements"] = "Itens insuficientes para atualização.", ["QuarryTurnedOn"] = "Quarry ligada.", ["QuarryStopped"] = "Quarry parada.", ["ExtractionIntervalText"] = "Intervalo: {0}s | Combustível: {1} {2}", ["StartButton"] = "Iniciar", ["StopButton"] = "Parar", ["RemoveButton"] = "Remover", ["UpgradeButton"] = "Atualizar", ["UpgradeToLevel"] = "Atualizar para Nível {0}", ["StorageHeader"] = "Armazém", ["FuelSlots"] = "Fuel: {0} slots", ["ResourceSlots"] = "Recursos: {0} slots", ["ExtractionHeader"] = "Extração", ["RequirementsHeader"] = "Requisitos", ["YesButton"] = "Sim", ["NoButton"] = "Não", ["ConfirmRemove"] = "Remover a Quarry?", ["ConfirmUpgrade"] = "Atualizar a Quarry?", ["QuarryLevel"] = "Quarry Nível: {0}", }, this, "pt-BR" ); lang.RegisterMessages( new Dictionary<string, string> { ["NoPermission"] = "Keine Berechtigung.", ["NoBuildingAuth"] = "Keine Baugenehmigung.", ["NoFundation"] = "Auf Basis setzen.", ["QuarryLimitReached"] = "Limit erreicht.", ["NotMiningQuarry"] = "Nicht eine Quarry.", ["NotOwner"] = "Anderer Spieler.", ["QuarryRemoved"] = "Quarry entfernt.", ["NoQuarriesFound"] = "Keine Quarry.", ["QuarrySend"] = "Quarry gesendet.", ["QuarryReceived"] = "Quarry erhalten.", ["QuarryDropped"] = "Boden gelegt.", ["PlayerNotFound"] = "Spieler fehlt.", ["TurnedOn"] = "Quarry an.", ["AlreadyOn"] = "Schon an.", ["NoFuel"] = "Kein Treibstoff.", ["NoSpace"] = "Kein Platz.", ["NotEmpty"] = "Vorher leeren.", ["UpgradeRequirements"] = "Fehlende Items.", ["QuarryTurnedOn"] = "Quarry aktiviert.", ["QuarryStopped"] = "Quarry gestoppt.", ["ExtractionIntervalText"] = "Intervall {0}s, Treib. {1} {2}", ["StartButton"] = "Starten", ["StopButton"] = "Stoppen", ["RemoveButton"] = "Entfernen", ["UpgradeButton"] = "Upgrade", ["UpgradeToLevel"] = "Stufe {0}", ["StorageHeader"] = "Lager", ["FuelSlots"] = "Treib.: {0} Pl.", ["ResourceSlots"] = "Ress.: {0} Pl.", ["ExtractionHeader"] = "Extrakt.", ["RequirementsHeader"] = "Anforderungen", ["YesButton"] = "Ja", ["NoButton"] = "Nein", ["ConfirmRemove"] = "Quarry entfernen?", ["ConfirmUpgrade"] = "Quarry upgraden?", ["QuarryLevel"] = "Stufe: {0}", }, this, "de" ); lang.RegisterMessages( new Dictionary<string, string> { ["NoPermission"] = "Sin permiso.", ["NoBuildingAuth"] = "Sin autorización.", ["NoFundation"] = "Debe estar en base.", ["QuarryLimitReached"] = "Límite alcanzado.", ["NotMiningQuarry"] = "No es una cantera.", ["NotOwner"] = "Pertenece a otro.", ["QuarryRemoved"] = "Cantera eliminada.", ["NoQuarriesFound"] = "No hay canteras.", ["QuarrySend"] = "Cantera enviada.", ["QuarryReceived"] = "Cantera recibida.", ["QuarryDropped"] = "Soltar al suelo.", ["PlayerNotFound"] = "Jugador no encontrado.", ["TurnedOn"] = "Cantera encendida.", ["AlreadyOn"] = "Ya está encendida.", ["NoFuel"] = "Combustible insuficiente.", ["NoSpace"] = "No hay espacio.", ["NotEmpty"] = "Vacíe antes.", ["UpgradeRequirements"] = "Faltan objetos.", ["QuarryTurnedOn"] = "Cantera activada.", ["QuarryStopped"] = "Cantera parada.", ["ExtractionIntervalText"] = "Intervalo {0}s, Comb: {1} {2}", ["StartButton"] = "Iniciar", ["StopButton"] = "Parar", ["RemoveButton"] = "Eliminar", ["UpgradeButton"] = "Mejorar", ["UpgradeToLevel"] = "Nivel {0}", ["StorageHeader"] = "Almacenaje", ["FuelSlots"] = "Comb.: {0} esp.", ["ResourceSlots"] = "Recursos: {0} esp.", ["ExtractionHeader"] = "Extracción", ["RequirementsHeader"] = "Requisitos", ["YesButton"] = "Sí", ["NoButton"] = "No", ["ConfirmRemove"] = "¿Eliminar cantera?", ["ConfirmUpgrade"] = "¿Mejorar cantera?", ["QuarryLevel"] = "Nivel: {0}", }, this, "es" ); lang.RegisterMessages( new Dictionary<string, string> { ["NoPermission"] = "Нет доступа.", ["NoBuildingAuth"] = "Нет доступа.", ["NoFundation"] = "Только на базе.", ["QuarryLimitReached"] = "Лимит достигнут.", ["NotMiningQuarry"] = "Не шахта.", ["NotOwner"] = "Принадлежит другому.", ["QuarryRemoved"] = "Удалена.", ["NoQuarriesFound"] = "Шахт нет.", ["QuarrySend"] = "Шахта отправлена.", ["QuarryReceived"] = "Шахта получена.", ["QuarryDropped"] = "На землю.", ["PlayerNotFound"] = "Игрок не найден.", ["TurnedOn"] = "Шахта включена.", ["AlreadyOn"] = "Уже включена.", ["NoFuel"] = "Мало топлива.", ["NoSpace"] = "Нет места.", ["NotEmpty"] = "Очистите сначала.", ["UpgradeRequirements"] = "Недостаточно.", ["QuarryTurnedOn"] = "Активировано.", ["QuarryStopped"] = "Остановлено.", ["ExtractionIntervalText"] = "Интервал {0}с, Топливо: {1} {2}", ["StartButton"] = "Старт", ["StopButton"] = "Стоп", ["RemoveButton"] = "Удалить", ["UpgradeButton"] = "Улучшить", ["UpgradeToLevel"] = "Уровень {0}", ["StorageHeader"] = "Хранилище", ["FuelSlots"] = "Топливо: {0} м.", ["ResourceSlots"] = "Ресурсы: {0} м.", ["ExtractionHeader"] = "Добыча", ["RequirementsHeader"] = "Требования", ["YesButton"] = "Да", ["NoButton"] = "Нет", ["ConfirmRemove"] = "Удалить?", ["ConfirmUpgrade"] = "Улучшить?", ["QuarryLevel"] = "Уровень: {0}", }, this, "ru" ); } - Assistant
The code you provided is for implementing multi-language support in a software application, likely a game, where a user can interact with mining quarries. The code registers messages in various languages—English, Portuguese (pt-BR), German (de), Spanish (es), and Russian (ru)—to support players who speak different languages.
Here's a breakdown of what each part does:
-
LoadDefaultMessages(): This method is responsible for loading the default messages that the application will use. It registers various messages in different languages. -
lang.RegisterMessages(): This function is used to register a set of messages with the language system. It takes a dictionary of message keys and their respective translations, along with the context (this) and an optional language code (e.g., "pt-BR" for Brazilian Portuguese).
-
- User
crie tbm para chinesa
- Assistant
Para adicionar suporte para mensagens em chinês, você precisa adicionar um novo bloco de código de
lang.RegisterMessages(), semelhante aos que já existem para outras línguas. Vou fornecer um exemplo de como isso poderia ser feito em chinês simplificado (zh-CN):lang.RegisterMessages( new Dictionary<string, string> { ["NoPermission"] = "您没有使用该命令的权限。", ["NoBuildingAuth"] = "您必须有建筑权限才能使用。", ["NoFundation"] = "必须放置在基础上。", ["QuarryLimitReached"] = "已达到采石场限制。", ["NotMiningQuarry"] = "该对象不是采石场。", ["NotOwner"] = "该对象属于其他玩家。", ["QuarryRemoved"] = "采石场已移除。", ["NoQuarriesFound"] = "未找到采石场。", ["QuarrySend"] = "您已将采石场发送给玩家。", ["QuarryReceived"] = "您已收到采石场。", ["QuarryDropped"] = "库存空间不足!采石场已掉落在地上。", ["PlayerNotFound"] = "未找到玩家。", ["TurnedOn"] = "采石场已开启。", ["AlreadyOn"] = "采石场已经开启。", ["NoFuel"] = "燃料不足以开始开采。", ["NoSpace"] = "输出空间不足以容纳提取的资源。", ["NotEmpty"] = "采石场仍有物品。请在移除前清空。", ["UpgradeRequirements"] = "您没有所需的物品来升级。", ["QuarryTurnedOn"] = "采石场已开启。", ["QuarryStopped"] = "采石场已停止。", ["ExtractionIntervalText"] = "提取间隔:{0} 秒 | 每次提取的燃料:{1} {2}", ["StartButton"] = "开始", ["StopButton"] = "停止", ["RemoveButton"] = "移除", ["UpgradeButton"] = "升级", ["UpgradeToLevel"] = "升级到级别 {0}", ["StorageHeader"] = "存储", ["FuelSlots"] = "燃料:{0} 个槽", ["ResourceSlots"] = "资源:{0} 个槽", ["ExtractionHeader"] = "提取", ["RequirementsHeader"] = "要求", ["YesButton"] = "是", ["NoButton"] = "否", ["ConfirmRemove"] = "移除采石场?", ["ConfirmUpgrade"] = "升级采石场?", ["QuarryLevel"] = "采石场级别 {0}", }, this, "zh-CN" );