diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index 9f9f6547d..61abc27ba 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -63,7 +63,6 @@ import { trackPromise } from '@/misc/promise-tracker.js'; import { isUserRelated } from '@/misc/is-user-related.js'; import { isNotNull } from '@/misc/is-not-null.js'; import { IdentifiableError } from '@/misc/identifiable-error.js'; -import { langmap } from '@/misc/langmap.js'; type NotificationType = 'reply' | 'renote' | 'quote' | 'mention'; @@ -339,13 +338,6 @@ export class NoteCreateService implements OnApplicationShutdown { data.text = null; } - if (data.lang) { - if (!Object.keys(langmap).includes(data.lang.toLowerCase())) throw new Error('invalid param'); - data.lang = data.lang.toLowerCase(); - } else { - data.lang = null; - } - let tags = data.apHashtags; let emojis = data.apEmojis; let mentionedUsers = data.apMentions; diff --git a/packages/backend/src/core/NoteEditService.ts b/packages/backend/src/core/NoteEditService.ts index 3d8f52947..8a631fd27 100644 --- a/packages/backend/src/core/NoteEditService.ts +++ b/packages/backend/src/core/NoteEditService.ts @@ -52,7 +52,6 @@ import { isReply } from '@/misc/is-reply.js'; import { trackPromise } from '@/misc/promise-tracker.js'; import { isUserRelated } from '@/misc/is-user-related.js'; import { IdentifiableError } from '@/misc/identifiable-error.js'; -import { langmap } from '@/misc/langmap.js'; type NotificationType = 'reply' | 'renote' | 'quote' | 'mention' | 'edited'; @@ -360,13 +359,6 @@ export class NoteEditService implements OnApplicationShutdown { data.text = null; } - if (data.lang) { - if (!Object.keys(langmap).includes(data.lang.toLowerCase())) throw new Error('invalid param'); - data.lang = data.lang.toLowerCase(); - } else { - data.lang = null; - } - let tags = data.apHashtags; let emojis = data.apEmojis; let mentionedUsers = data.apMentions; diff --git a/packages/backend/src/core/activitypub/models/ApNoteService.ts b/packages/backend/src/core/activitypub/models/ApNoteService.ts index d2f5f124f..204846f7d 100644 --- a/packages/backend/src/core/activitypub/models/ApNoteService.ts +++ b/packages/backend/src/core/activitypub/models/ApNoteService.ts @@ -256,7 +256,7 @@ export class ApNoteService { let lang: string | null = null; if (note.contentMap != null) { - const key = Object.keys(note.contentMap)[0].toLowerCase(); + const key = Object.keys(note.contentMap)[0]; lang = Object.keys(langmap).includes(key) ? key : null; } @@ -474,7 +474,7 @@ export class ApNoteService { let lang: string | null = null; if (note.contentMap != null) { - const key = Object.keys(note.contentMap)[0].toLowerCase(); + const key = Object.keys(note.contentMap)[0]; lang = Object.keys(langmap).includes(key) ? key : null; } diff --git a/packages/backend/src/misc/langmap.ts b/packages/backend/src/misc/langmap.ts index 1d2ec2821..6b6e8b5b7 100644 --- a/packages/backend/src/misc/langmap.ts +++ b/packages/backend/src/misc/langmap.ts @@ -376,10 +376,10 @@ export const iso639Langs3 = { export const langmapNoRegion = Object.assign({}, iso639Langs1, iso639Langs3); export const iso639Regional = { - 'zh-hans': { + 'zh-Hans': { nativeName: '中文(简体)', }, - 'zh-hant': { + 'zh-Hant': { nativeName: '中文(繁體)', }, }; diff --git a/packages/backend/src/server/api/endpoints/notes/edit.ts b/packages/backend/src/server/api/endpoints/notes/edit.ts index e12c088e3..fa2225667 100644 --- a/packages/backend/src/server/api/endpoints/notes/edit.ts +++ b/packages/backend/src/server/api/endpoints/notes/edit.ts @@ -380,13 +380,6 @@ export default class extends Endpoint { // eslint- } } - if (ps.lang) { - if (!Object.keys(langmap).includes(ps.lang.toLowerCase())) throw new Error('invalid param'); - ps.lang = ps.lang.toLowerCase(); - } else { - ps.lang = null; - } - let channel: MiChannel | null = null; if (ps.channelId != null) { channel = await this.channelsRepository.findOneBy({ id: ps.channelId, isArchived: false }); diff --git a/packages/frontend/src/scripts/langmap.ts b/packages/frontend/src/scripts/langmap.ts index 4eb3067e1..eb23fe2d7 100644 --- a/packages/frontend/src/scripts/langmap.ts +++ b/packages/frontend/src/scripts/langmap.ts @@ -376,10 +376,10 @@ export const iso639Langs3 = { export const langmapNoRegion = Object.assign({}, iso639Langs1, iso639Langs3); export const iso639Regional = { - 'zh-hans': { + 'zh-Hans': { nativeName: '中文(简体)', }, - 'zh-hant': { + 'zh-Hant': { nativeName: '中文(繁體)', }, };