Skip to content

Commit

Permalink
Add new languages
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffvli committed May 7, 2024
1 parent ebd97c2 commit 6858485
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/i18n/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import sv from './locales/sv.json';
import cs from './locales/cs.json';
import nbNO from './locales/nb-NO.json';
import nl from './locales/nl.json';
import zhHant from './locales/zh-Hant.json';
import fa from './locales/fa.json';

const resources = {
en: { translation: en },
Expand All @@ -24,10 +26,12 @@ const resources = {
it: { translation: it },
ru: { translation: ru },
'pt-BR': { translation: ptBr },
fa: { translation: fa },
fr: { translation: fr },
ja: { translation: ja },
pl: { translation: pl },
'zh-Hans': { translation: zhHans },
'zh-Hant': { translation: zhHant },
sr: { translation: sr },
sv: { translation: sv },
cs: { translation: cs },
Expand Down Expand Up @@ -72,7 +76,10 @@ export const languages = [
label: 'Norsk (Bokmål)',
value: 'nb-NO',
},

{
label: 'فارسی',
value: 'fa',
},
{
label: 'Português (Brasil)',
value: 'pt-BR',
Expand All @@ -97,6 +104,10 @@ export const languages = [
label: '简体中文',
value: 'zh-Hans',
},
{
label: '繁體中文',
value: 'zh-Hant',
},
];

const lowerCasePostProcessor: PostProcessorModule = {
Expand Down Expand Up @@ -125,7 +136,7 @@ const titleCasePostProcessor: PostProcessorModule = {
},
};

const ignoreSentenceCaseLanguages = ['de']
const ignoreSentenceCaseLanguages = ['de'];

const sentenceCasePostProcessor: PostProcessorModule = {
type: 'postProcessor',
Expand All @@ -136,7 +147,10 @@ const sentenceCasePostProcessor: PostProcessorModule = {
return sentences
.map((sentence) => {
return (
sentence.charAt(0).toLocaleUpperCase() + (!ignoreSentenceCaseLanguages.includes(translator.language) ? sentence.slice(1).toLocaleLowerCase() : sentence.slice(1))
sentence.charAt(0).toLocaleUpperCase() +
(!ignoreSentenceCaseLanguages.includes(translator.language)
? sentence.slice(1).toLocaleLowerCase()
: sentence.slice(1))
);
})
.join('. ');
Expand Down

0 comments on commit 6858485

Please sign in to comment.