Use proper casing for i18n locales (#1998)

This commit is contained in:
Jeff
2026-05-11 19:42:07 -07:00
committed by GitHub
parent e49e488b4c
commit e2a1d813a9
224 changed files with 17323 additions and 18474 deletions
+4 -12
View File
@@ -1,4 +1,4 @@
import { PostProcessorModule, TOptions } from 'i18next';
import { PostProcessorModule } from 'i18next';
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
@@ -203,25 +203,17 @@ const titleCasePostProcessor: PostProcessorModule = {
type: 'postProcessor',
};
const ignoreSentenceCaseLanguages = ['de'];
// const ignoreSentenceCaseLanguages = ['de'];
const sentenceCasePostProcessor: PostProcessorModule = {
name: 'sentenceCase',
process: (
value: string,
_key: string,
_options: TOptions<Record<string, string>>,
translator: any,
) => {
process: (value: string) => {
const sentences = value.split('. ');
return sentences
.map((sentence) => {
return (
sentence.charAt(0).toLocaleUpperCase() +
(!ignoreSentenceCaseLanguages.includes(translator.language)
? sentence.slice(1).toLocaleLowerCase()
: sentence.slice(1))
sentence.charAt(0).toLocaleUpperCase() + sentence.slice(1).toLocaleLowerCase()
);
})
.join('. ');