mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-22 17:23:08 +02:00
fix: Do not convert langs to lowercase
This commit is contained in:
parent
112272c254
commit
4f45e72799
6 changed files with 6 additions and 29 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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: '中文(繁體)',
|
||||
},
|
||||
};
|
||||
|
|
|
@ -380,13 +380,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // 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 });
|
||||
|
|
|
@ -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: '中文(繁體)',
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue