i18n: add Chinese and Japanese language support for message (#1018)

This commit is contained in:
pa
2024-12-12 11:51:01 +09:00
committed by GitHub
parent 9b245165f6
commit 615f3e1703
7 changed files with 245 additions and 54 deletions

View File

@@ -1277,7 +1277,7 @@ speechSynthesis.getVoices();
throw err;
}
$app.$message({
message: "you're not allowed to access this instance.",
message: $t('message.instance.not_allowed'),
type: 'error'
});
throw err;
@@ -5420,7 +5420,7 @@ speechSynthesis.getVoices();
} catch (err) {
if (!$app.dontLogMeOut) {
$app.$message({
message: 'Failed to load friends list, logging out',
message: $t('message.friend.load_failed'),
type: 'error'
});
this.logout();
@@ -9468,7 +9468,7 @@ speechSynthesis.getVoices();
D.isMuteChat = true;
}
$app.$message({
message: 'User moderated',
message: $t('message.user.moderated'),
type: 'success'
});
});
@@ -10788,16 +10788,30 @@ speechSynthesis.getVoices();
this.setPlayerModeration(D.id, 5);
}
} else {
this.$confirm(`Continue? ${command}`, 'Confirm', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'info',
callback: (action) => {
if (action === 'confirm') {
performUserDialogCommand(command, D.id);
const i18nPreFix = 'dialog.user.actions.';
const formattedCommand = command.toLowerCase().replace(/ /g, '_');
const displayCommandText = $t(
`${i18nPreFix}${formattedCommand}`
).includes('i18nPreFix')
? command
: $t(`${i18nPreFix}${formattedCommand}`);
this.$confirm(
$t('confirm.message', {
command: displayCommandText
}),
$t('confirm.title'),
{
confirmButtonText: $t('confirm.confirm_button'),
cancelButtonText: $t('confirm.cancel_button'),
type: 'info',
callback: (action) => {
if (action === 'confirm') {
performUserDialogCommand(command, D.id);
}
}
}
});
);
}
};
@@ -13775,7 +13789,7 @@ speechSynthesis.getVoices();
if (files[0].size >= 100000000) {
// 100MB
$app.$message({
message: 'File size too large',
message: $t('message.file.too_large'),
type: 'error'
});
clearFile();
@@ -13783,7 +13797,7 @@ speechSynthesis.getVoices();
}
if (!files[0].type.match(/image.*/)) {
$app.$message({
message: "File isn't an image",
message: $t('message.file.not_image'),
type: 'error'
});
clearFile();
@@ -13794,7 +13808,7 @@ speechSynthesis.getVoices();
var base64Body = btoa(r.result);
API.uploadVRCPlusIcon(base64Body).then((args) => {
$app.$message({
message: 'Icon uploaded',
message: $t('message.icon.uploaded'),
type: 'success'
});
return args;
@@ -13843,7 +13857,7 @@ speechSynthesis.getVoices();
if (files[0].size >= 100000000) {
// 100MB
$app.$message({
message: 'File size too large',
message: $t('message.file.too_large'),
type: 'error'
});
this.clearInviteImageUpload();
@@ -13851,7 +13865,7 @@ speechSynthesis.getVoices();
}
if (!files[0].type.match(/image.*/)) {
$app.$message({
message: "File isn't a png",
message: $t('message.file.not_image'),
type: 'error'
});
this.clearInviteImageUpload();
@@ -14933,7 +14947,7 @@ speechSynthesis.getVoices();
if (files[0].size >= 100000000) {
// 100MB
$app.$message({
message: 'File size too large',
message: $t('message.file.too_large'),
type: 'error'
});
clearFile();
@@ -14941,7 +14955,7 @@ speechSynthesis.getVoices();
}
if (!files[0].type.match(/image.*/)) {
$app.$message({
message: "File isn't a png",
message: $t('message.file.not_image'),
type: 'error'
});
clearFile();
@@ -14966,7 +14980,7 @@ speechSynthesis.getVoices();
var fileId = $utils.extractFileId(imageUrl);
if (!fileId) {
$app.$message({
message: 'Current avatar image invalid',
message: $t('message.avatar.image_invalid'),
type: 'error'
});
clearFile();
@@ -15269,7 +15283,7 @@ speechSynthesis.getVoices();
if (files[0].size >= 100000000) {
// 100MB
$app.$message({
message: 'File size too large',
message: $t('message.file.too_large'),
type: 'error'
});
clearFile();
@@ -15277,7 +15291,7 @@ speechSynthesis.getVoices();
}
if (!files[0].type.match(/image.*/)) {
$app.$message({
message: "File isn't a png",
message: $t('message.file.not_image'),
type: 'error'
});
clearFile();
@@ -15302,7 +15316,7 @@ speechSynthesis.getVoices();
var fileId = $utils.extractFileId(imageUrl);
if (!fileId) {
$app.$message({
message: 'Current world image invalid',
message: $t('message.world.image_invalid'),
type: 'error'
});
clearFile();
@@ -15590,7 +15604,7 @@ speechSynthesis.getVoices();
$app.changeAvatarImageDialogLoading = false;
if (args.json.imageUrl === args.params.imageUrl) {
$app.$message({
message: 'Avatar image changed',
message: $t('message.avatar.image_changed'),
type: 'success'
});
$app.displayPreviousImages('Avatar', 'Change');
@@ -15604,7 +15618,7 @@ speechSynthesis.getVoices();
$app.changeWorldImageDialogLoading = false;
if (args.json.imageUrl === args.params.imageUrl) {
$app.$message({
message: 'World image changed',
message: $t('message.world.image_changed'),
type: 'success'
});
$app.displayPreviousImages('World', 'Change');
@@ -16464,7 +16478,7 @@ speechSynthesis.getVoices();
var D = this.screenshotMetadataDialog;
if (D.metadata.fileSizeBytes > 10000000) {
$app.$message({
message: 'File size too large',
message: $t('message.file.too_large'),
type: 'error'
});
return;
@@ -16475,7 +16489,7 @@ speechSynthesis.getVoices();
API.uploadGalleryImage(base64Body)
.then((args) => {
$app.$message({
message: 'Gallery image uploaded',
message: $t('message.gallery.uploaded'),
type: 'success'
});
return args;
@@ -16486,7 +16500,7 @@ speechSynthesis.getVoices();
})
.catch((err) => {
$app.$message({
message: 'Failed to upload gallery image',
message: $t('message.gallery.failed'),
type: 'error'
});
console.error(err);
@@ -17459,7 +17473,7 @@ speechSynthesis.getVoices();
if (files[0].size >= 100000000) {
// 100MB
$app.$message({
message: 'File size too large',
message: $t('message.file.too_large'),
type: 'error'
});
clearFile();
@@ -17467,7 +17481,7 @@ speechSynthesis.getVoices();
}
if (!files[0].type.match(/image.*/)) {
$app.$message({
message: "File isn't an image",
message: $t('message.file.not_image'),
type: 'error'
});
clearFile();
@@ -17478,7 +17492,7 @@ speechSynthesis.getVoices();
var base64Body = btoa(r.result);
API.uploadGalleryImage(base64Body).then((args) => {
$app.$message({
message: 'Gallery image uploaded',
message: $t('message.gallery.uploaded'),
type: 'success'
});
return args;
@@ -17570,7 +17584,7 @@ speechSynthesis.getVoices();
if (files[0].size >= 100000000) {
// 100MB
$app.$message({
message: 'File size too large',
message: $t('message.file.too_large'),
type: 'error'
});
clearFile();
@@ -17578,7 +17592,7 @@ speechSynthesis.getVoices();
}
if (!files[0].type.match(/image.*/)) {
$app.$message({
message: "File isn't an image",
message: $t('message.file.not_image'),
type: 'error'
});
clearFile();
@@ -17593,7 +17607,7 @@ speechSynthesis.getVoices();
var base64Body = btoa(r.result);
API.uploadSticker(base64Body, params).then((args) => {
$app.$message({
message: 'Sticker uploaded',
message: $t('message.sticker.uploaded'),
type: 'success'
});
return args;
@@ -17728,7 +17742,7 @@ speechSynthesis.getVoices();
if (files[0].size >= 100000000) {
// 100MB
$app.$message({
message: 'File size too large',
message: $t('message.file.too_large'),
type: 'error'
});
clearFile();
@@ -17736,7 +17750,7 @@ speechSynthesis.getVoices();
}
if (!files[0].type.match(/image.*/)) {
$app.$message({
message: "File isn't an image",
message: $t('message.file.not_image'),
type: 'error'
});
clearFile();
@@ -17756,7 +17770,7 @@ speechSynthesis.getVoices();
var base64Body = btoa(r.result);
API.uploadPrint(base64Body, params).then((args) => {
$app.$message({
message: 'Print uploaded',
message: $t('message.print.uploaded'),
type: 'success'
});
return args;
@@ -17940,7 +17954,7 @@ speechSynthesis.getVoices();
if (files[0].size >= 100000000) {
// 100MB
$app.$message({
message: 'File size too large',
message: $t('message.file.too_large'),
type: 'error'
});
clearFile();
@@ -17948,7 +17962,7 @@ speechSynthesis.getVoices();
}
if (!files[0].type.match(/image.*/)) {
$app.$message({
message: "File isn't an image",
message: $t('message.file.not_image'),
type: 'error'
});
clearFile();
@@ -17973,7 +17987,7 @@ speechSynthesis.getVoices();
var base64Body = btoa(r.result);
API.uploadEmoji(base64Body, params).then((args) => {
$app.$message({
message: 'Emoji uploaded',
message: $t('message.emoji.uploaded'),
type: 'success'
});
return args;
@@ -21389,7 +21403,9 @@ speechSynthesis.getVoices();
API.queuedInstances.forEach((ref) => {
if (ref.location !== instanceId) {
$app.$message({
message: `Removed instance ${ref.$worldName} from queue`,
message: $t('message.instance.removed_form_queue', {
worldName: ref.$worldName
}),
type: 'info'
});
ref.$msgBox?.close();
@@ -21676,7 +21692,7 @@ speechSynthesis.getVoices();
}
} else {
$app.$message({
message: 'Failed to change avatar moderation',
message: $t('message.avatar.change_moderation_failed'),
type: 'error'
});
}
@@ -22166,7 +22182,7 @@ speechSynthesis.getVoices();
API.$on('INSTANCE:CLOSE', function (args) {
if (args.json) {
$app.$message({
message: 'Instance closed',
message: $t('message.instance.closed'),
type: 'success'
});
@@ -22345,7 +22361,7 @@ speechSynthesis.getVoices();
API.$on('BADGE:UPDATE', function (args) {
if (args.json) {
$app.$message({
message: 'Badge updated',
message: $t('message.badge.updated'),
type: 'success'
});
}