Skip to content

Commit fef8027

Browse files
authored
feat(i18n): add support for Portuguese (Brazil) language (pt_br) (#34)
* feat(i18n): add support for Portuguese (Brazil) language (pt_br)
1 parent 0f48cc6 commit fef8027

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,24 @@ To remove description:
8484
oc config set description=false
8585
```
8686

87+
### Internationalization support
88+
89+
To specify the language used to generate commit messages:
90+
91+
```sh
92+
# de, German ,Deutsch
93+
oc config set language=de
94+
oc config set language=German
95+
oc config set language=Deutsch
96+
97+
# fr, French, française
98+
oc config set language=fr
99+
oc config set language=French
100+
oc config set language=française
101+
```
102+
The default language set is **English**
103+
All available languages are currently listed in the [i18n](https://github.com/di-sukharev/opencommit/tree/master/src/i18n) folder
104+
87105
### Git flags
88106

89107
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`.

src/i18n/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import ko from '../i18n/ko.json' assert { type: 'json' };
66
import zh_CN from '../i18n/zh_CN.json' assert { type: 'json' };
77
import zh_TW from '../i18n/zh_TW.json' assert { type: 'json' };
88
import ja from '../i18n/ja.json' assert { type: 'json' };
9+
import pt_br from '../i18n/pt_br.json' assert { type: 'json' };
910

1011
export enum I18nLocals {
1112
'en' = 'en',
@@ -15,7 +16,8 @@ export enum I18nLocals {
1516
'de' = 'de',
1617
'fr' = 'fr',
1718
'it' = 'it',
18-
'ko' = 'ko'
19+
'ko' = 'ko',
20+
'pt_br' = 'pt_br'
1921
};
2022

2123
export const i18n = {
@@ -27,6 +29,7 @@ export const i18n = {
2729
fr,
2830
it,
2931
ko,
32+
pt_br
3033
};
3134

3235
export const I18N_CONFIG_ALIAS: { [key: string]: string[] } = {
@@ -37,6 +40,8 @@ export const I18N_CONFIG_ALIAS: { [key: string]: string[] } = {
3740
de: ['de', 'German' ,'Deutsch'],
3841
fr: ['fr', 'French', 'française'],
3942
it: ['it', 'Italian', 'italiano'],
43+
pt_br: ['pt_br', 'Portuguese', 'português'],
44+
en: ['en', 'English', 'english'],
4045
};
4146

4247
export function getI18nLocal(value: string): string | boolean {

src/i18n/pt_br.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"localLanguage": "português",
3+
"commitFix": "fix(server.ts): altera o caso da variável de porta de port minúscula para PORT maiúscula",
4+
"commitFeat": "feat(server.ts): adiciona suporte para a variável de ambiente process.env.PORT",
5+
"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."
6+
}
7+

0 commit comments

Comments
 (0)