mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-16 13:40:24 +02:00
remove sentence case override configuration
This commit is contained in:
+4
-12
@@ -1,4 +1,4 @@
|
|||||||
import { PostProcessorModule, TOptions } from 'i18next';
|
import { PostProcessorModule } from 'i18next';
|
||||||
import i18n from 'i18next';
|
import i18n from 'i18next';
|
||||||
import { initReactI18next } from 'react-i18next';
|
import { initReactI18next } from 'react-i18next';
|
||||||
|
|
||||||
@@ -203,25 +203,17 @@ const titleCasePostProcessor: PostProcessorModule = {
|
|||||||
type: 'postProcessor',
|
type: 'postProcessor',
|
||||||
};
|
};
|
||||||
|
|
||||||
const ignoreSentenceCaseLanguages = ['de'];
|
// const ignoreSentenceCaseLanguages = ['de'];
|
||||||
|
|
||||||
const sentenceCasePostProcessor: PostProcessorModule = {
|
const sentenceCasePostProcessor: PostProcessorModule = {
|
||||||
name: 'sentenceCase',
|
name: 'sentenceCase',
|
||||||
process: (
|
process: (value: string) => {
|
||||||
value: string,
|
|
||||||
_key: string,
|
|
||||||
_options: TOptions<Record<string, string>>,
|
|
||||||
translator: any,
|
|
||||||
) => {
|
|
||||||
const sentences = value.split('. ');
|
const sentences = value.split('. ');
|
||||||
|
|
||||||
return sentences
|
return sentences
|
||||||
.map((sentence) => {
|
.map((sentence) => {
|
||||||
return (
|
return (
|
||||||
sentence.charAt(0).toLocaleUpperCase() +
|
sentence.charAt(0).toLocaleUpperCase() + sentence.slice(1).toLocaleLowerCase()
|
||||||
(!ignoreSentenceCaseLanguages.includes(translator.language)
|
|
||||||
? sentence.slice(1).toLocaleLowerCase()
|
|
||||||
: sentence.slice(1))
|
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.join('. ');
|
.join('. ');
|
||||||
|
|||||||
Reference in New Issue
Block a user