Feat: i18n text

This commit is contained in:
wangkun 2023-12-12 11:30:46 +08:00
parent fc44b8ef80
commit f1eae98244
4 changed files with 17 additions and 38 deletions

View File

@ -1015,9 +1015,7 @@ export const configData: {
Settings: {
ServerPassword: t("TXT_CODE_448df2bd"),
ServerPort: t("TXT_CODE_a379038f"),
MaxSlots: t(
"最大同时连接数。如果你想让玩家被踢出“服务器已满”的设定请将其设置为你设置的最大玩家数然后将泰拉瑞亚的最大玩家设置为2个或以上"
),
MaxSlots: t("TXT_CODE_e304faa"),
ReservedSlots: t("TXT_CODE_369a4a22"),
ServerName: t("TXT_CODE_60e3c342"),
UseServerName: t("TXT_CODE_8a924345"),
@ -1071,22 +1069,14 @@ export const configData: {
PreventInvalidPlaceStyle: t("TXT_CODE_fe82609a"),
ForceXmas: t("TXT_CODE_b649a71a"),
ForceHalloween: t("TXT_CODE_ac52ad06"),
AllowAllowedGroupsToSpawnBannedItems: t(
"允许禁止项目允许列表中的组生成被禁止的项目,即使 PreventBannedItemSpawn 设置为 true"
),
RespawnSeconds: t(
"玩家在重生之前必须等待的秒数。有效范围0默认值到 15 秒。使用风险自负"
),
RespawnBossSeconds: t(
"如果附近有 Boss玩家在重生之前必须等待的秒数。有效范围0默认值到 30 秒。使用风险自负"
),
AllowAllowedGroupsToSpawnBannedItems: t("TXT_CODE_3f3e734b"),
RespawnSeconds: t("TXT_CODE_288830f4"),
RespawnBossSeconds: t("TXT_CODE_b45e73fb"),
AnonymousBossInvasions: t("TXT_CODE_87e18bb5"),
MaxHP: t("TXT_CODE_3f470950"),
MaxMP: t("TXT_CODE_95dfd5bd"),
BombExplosionRadius: t("TXT_CODE_f71475e2"),
GiveItemsDirectly: t(
"如果设置为 true则给予玩家的物品将直接插入到他们的物品栏中。否则给予玩家的物品将作为掉落的物品生成。实验性功能可能无法正常工作或导致物品丢失"
),
GiveItemsDirectly: t("TXT_CODE_260d96a0"),
DefaultRegistrationGroupName: t("TXT_CODE_cfd64e73"),
DefaultGuestGroupName: t("TXT_CODE_90896d08"),
RememberLeavePos: t("TXT_CODE_52b31aef"),
@ -1099,9 +1089,7 @@ export const configData: {
EnableWhitelist: t("TXT_CODE_d0e37f20"),
WhitelistKickReason: t("TXT_CODE_f160d877"),
ServerFullReason: t("TXT_CODE_4ff6a125"),
ServerFullNoReservedReason: t(
"在服务器已满且没有可用预留插槽的情况下踢出试图加入的玩家时给出的原因"
),
ServerFullNoReservedReason: t("TXT_CODE_5f23008"),
KickOnHardcoreDeath: t("TXT_CODE_95340802"),
HardcoreKickReason: t("TXT_CODE_129475a7"),
BanOnHardcoreDeath: t("TXT_CODE_8ab0cc1a"),
@ -1130,14 +1118,10 @@ export const configData: {
KickOnProjectileThresholdBroken: t("TXT_CODE_946d4401"),
HealOtherThreshold: t("TXT_CODE_449efd26"),
KickOnHealOtherThresholdBroken: t("TXT_CODE_e0643e6f"),
SuppressPermissionFailureNotices: t(
"禁止来自区域、重生点或服务器编辑失败的生成权限失败的警告"
),
SuppressPermissionFailureNotices: t("TXT_CODE_decf21ee"),
DisableModifiedZenith: t("TXT_CODE_d4b058a9"),
DisableCustomDeathMessages: t("TXT_CODE_5143c584"),
CommandSpecifier: t(
"指定哪个字符串作为命令的起始部分。如果长度大于1则可能无法正常工作。"
),
CommandSpecifier: t("TXT_CODE_235cd293"),
CommandSilentSpecifier: t("TXT_CODE_1049cbd1"),
DisableSpewLogs: t("TXT_CODE_f29d5d2"),
DisableSecondUpdateLogs: t("TXT_CODE_ef97db20"),
@ -1146,12 +1130,8 @@ export const configData: {
SuperAdminChatSuffix: t("TXT_CODE_5bc16b9a"),
EnableGeoIP: t("TXT_CODE_6bf4665b"),
DisplayIPToAdmins: t("TXT_CODE_1b763e24"),
ChatFormat: t(
"更改游戏内聊天格式:{0} = 群组名称,{1} = 群组前缀,{2} = 玩家名称,{3} = 群组后缀,{4} = 聊天消息。"
),
ChatAboveHeadsFormat: t(
"更改在头顶聊天时使用的玩家名称。以方括号包裹的玩家名称开头,格式与 Terraria 的一致。与 ChatFormat 相同的格式,但不包括消息。"
),
ChatFormat: t("TXT_CODE_2374966e"),
ChatAboveHeadsFormat: t("TXT_CODE_97535446"),
EnableChatAboveHeads: t("TXT_CODE_9c39c7ae"),
BroadcastRGB: t("TXT_CODE_11d2ab6b"),
StorageType: t("TXT_CODE_8e5f865e"),
@ -1167,9 +1147,7 @@ export const configData: {
LogRest: t("TXT_CODE_fdd1a61"),
EnableTokenEndpointAuthentication: t("TXT_CODE_b9d7fe43"),
RESTMaximumRequestsPerInterval: t("TXT_CODE_8298bfde"),
RESTRequestBucketDecreaseIntervalMinutes: t(
"REST 请求存储桶减少 1 的频率(以分钟为单位)。最小值为 1 分钟"
),
RESTRequestBucketDecreaseIntervalMinutes: t("TXT_CODE_5b190bc4"),
ApplicationRestTokens: t("TXT_CODE_f0ca2761")
}
}

View File

@ -162,7 +162,7 @@ const save = async () => {
</div>
<a-modal
v-model:open="open"
:title="t('设置图片列表')"
:title="t('TXT_CODE_4a56836d')"
:closable="false"
:destroy-on-close="true"
>
@ -171,7 +171,7 @@ const save = async () => {
v-for="(imgItem, index) in imgList"
:key="imgItem.url + imgItem.key"
v-bind="formItemLayout"
:label="`${t('图片')} ${index + 1}`"
:label="`${t('TXT_CODE_9900f79e')} ${index + 1}`"
:name="[index, 'url']"
:rules="{
required: true,
@ -200,7 +200,7 @@ const save = async () => {
<div v-else style="display: inline-flex; width: 80%">
<a-input :value="`${t('TXT_CODE_b625dbf0') + imgItem.uploadPercent}%`" disabled />
<a-tooltip :title="t('取消上传')">
<a-tooltip :title="t('TXT_CODE_7ec87e8a')">
<a-button type="link" @click="cancelUpload(imgItem)">
<CloseOutlined />
</a-button>

View File

@ -127,7 +127,7 @@ const close = () => {
</a-typography-paragraph>
</a-typography>
</a-tab-pane>
<a-tab-pane key="url" :tab="t('网络URL')" force-render>
<a-tab-pane key="url" :tab="t('TXT_CODE_ba42d467')" force-render>
<a-input v-model:value.lazy.trim="imgSrc" autofocus :placeholder="t('TXT_CODE_c8a51b2e')" />
</a-tab-pane>
</a-tabs>

View File

@ -37,7 +37,8 @@ module.exports = {
options.defaultValue = key;
let hashKey = `${FN_KEY}${crc32(key).toString(16)}`;
console.log("Transform text:", key, "->", hashKey);
newCode = String(newCode).replace(`t("${key}")`, `t("${hashKey}")`);
newCode = String(newCode).replace(`"${key}"`, `"${hashKey}"`);
newCode = String(newCode).replace(`'${key}'`, `'${hashKey}'`);
parser.set(hashKey, options);
});