mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
Fix translation titlecase for accented characters (#357)
This commit is contained in:
+4
-4
@@ -88,9 +88,7 @@ const titleCasePostProcessor: PostProcessorModule = {
|
|||||||
type: 'postProcessor',
|
type: 'postProcessor',
|
||||||
name: 'titleCase',
|
name: 'titleCase',
|
||||||
process: (value: string) => {
|
process: (value: string) => {
|
||||||
return value.replace(/\w\S*/g, (txt) => {
|
return value.charAt(0).toLocaleUpperCase() + value.slice(1).toLowerCase();
|
||||||
return txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -102,7 +100,9 @@ const sentenceCasePostProcessor: PostProcessorModule = {
|
|||||||
|
|
||||||
return sentences
|
return sentences
|
||||||
.map((sentence) => {
|
.map((sentence) => {
|
||||||
return sentence.charAt(0).toUpperCase() + sentence.slice(1).toLocaleLowerCase();
|
return (
|
||||||
|
sentence.charAt(0).toLocaleUpperCase() + sentence.slice(1).toLocaleLowerCase()
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.join('. ');
|
.join('. ');
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user