diff --git a/README.md b/README.md index cc3ffc5..73d6d1c 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,24 @@ To remove description: oc config set description=false ``` +### Internationalization support + +To specify the language used to generate commit messages: + +```sh +# de, German ,Deutsch +oc config set language=de +oc config set language=German +oc config set language=Deutsch + +# fr, French, française +oc config set language=fr +oc config set language=French +oc config set language=française +``` +The default language set is **English** +All available languages are currently listed in the [i18n](https://github.com/di-sukharev/opencommit/tree/master/src/i18n) folder + ### Git flags The `opencommit` or `oc` commands can be used in place of the `git commit -m "${generatedMessage}"` command. This means that any regular flags that are used with the `git commit` command will also be applied when using `opencommit` or `oc`. diff --git a/src/i18n/index.ts b/src/i18n/index.ts index 27590cc..0077b25 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -6,6 +6,7 @@ import ko from '../i18n/ko.json' assert { type: 'json' }; import zh_CN from '../i18n/zh_CN.json' assert { type: 'json' }; import zh_TW from '../i18n/zh_TW.json' assert { type: 'json' }; import ja from '../i18n/ja.json' assert { type: 'json' }; +import pt_br from '../i18n/pt_br.json' assert { type: 'json' }; export enum I18nLocals { 'en' = 'en', @@ -15,7 +16,8 @@ export enum I18nLocals { 'de' = 'de', 'fr' = 'fr', 'it' = 'it', - 'ko' = 'ko' + 'ko' = 'ko', + 'pt_br' = 'pt_br' }; export const i18n = { @@ -27,6 +29,7 @@ export const i18n = { fr, it, ko, + pt_br }; export const I18N_CONFIG_ALIAS: { [key: string]: string[] } = { @@ -37,6 +40,8 @@ export const I18N_CONFIG_ALIAS: { [key: string]: string[] } = { de: ['de', 'German' ,'Deutsch'], fr: ['fr', 'French', 'française'], it: ['it', 'Italian', 'italiano'], + pt_br: ['pt_br', 'Portuguese', 'português'], + en: ['en', 'English', 'english'], }; export function getI18nLocal(value: string): string | boolean { diff --git a/src/i18n/pt_br.json b/src/i18n/pt_br.json new file mode 100644 index 0000000..0c86700 --- /dev/null +++ b/src/i18n/pt_br.json @@ -0,0 +1,7 @@ +{ + "localLanguage": "português", + "commitFix": "fix(server.ts): altera o caso da variável de porta de port minúscula para PORT maiúscula", + "commitFeat": "feat(server.ts): adiciona suporte para a variável de ambiente process.env.PORT", + "commitDescription": "A variável de porta agora é denominada PORT, o que melhora a consistência com as convenções de nomenclatura, pois PORT é uma constante. O suporte para uma variável de ambiente permite que o aplicativo seja mais flexível, pois agora pode ser executado em qualquer porta disponível especificada por meio da variável de ambiente process.env.PORT." +} + \ No newline at end of file