3
3
4
4
from commitizen import defaults
5
5
from commitizen .cz .base import BaseCommitizen
6
+ from commitizen .cz .conventional_commits .translation_multilanguage import (
7
+ translate_text_from_eng ,
8
+ )
6
9
from commitizen .cz .utils import multiple_line_breaker , required_validator
7
10
from commitizen .defaults import Questions
8
11
@@ -40,70 +43,98 @@ class ConventionalCommitsCz(BaseCommitizen):
40
43
}
41
44
changelog_pattern = defaults .bump_pattern
42
45
43
- def questions (self ) -> Questions :
46
+ def questions (self , language : str ) -> Questions :
44
47
questions : Questions = [
45
48
{
46
49
"type" : "list" ,
47
50
"name" : "prefix" ,
48
- "message" : "Select the type of change you are committing" ,
51
+ "message" : translate_text_from_eng (
52
+ "Select the type of change you are committing" , language , "prefix"
53
+ ),
49
54
"choices" : [
50
55
{
51
56
"value" : "fix" ,
52
- "name" : "fix: A bug fix. Correlates with PATCH in SemVer" ,
57
+ "name" : "fix: "
58
+ + translate_text_from_eng (
59
+ "A bug fix. Correlates with PATCH in SemVer" ,
60
+ language ,
61
+ "fix" ,
62
+ ),
53
63
"key" : "x" ,
54
64
},
55
65
{
56
66
"value" : "feat" ,
57
- "name" : "feat: A new feature. Correlates with MINOR in SemVer" ,
67
+ "name" : "feat: "
68
+ + translate_text_from_eng (
69
+ "A new feature. Correlates with MINOR in SemVer" ,
70
+ language ,
71
+ "feat" ,
72
+ ),
58
73
"key" : "f" ,
59
74
},
60
75
{
61
76
"value" : "docs" ,
62
- "name" : "docs: Documentation only changes" ,
77
+ "name" : "docs: "
78
+ + translate_text_from_eng (
79
+ "Documentation only changes" , language , "docs"
80
+ ),
63
81
"key" : "d" ,
64
82
},
65
83
{
66
84
"value" : "style" ,
67
- "name" : (
68
- "style: Changes that do not affect the "
69
- "meaning of the code (white-space, formatting,"
70
- " missing semi-colons, etc)"
85
+ "name" : "style: "
86
+ + translate_text_from_eng (
87
+ """Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)""" ,
88
+ language ,
89
+ "style" ,
71
90
),
72
91
"key" : "s" ,
73
92
},
74
93
{
75
94
"value" : "refactor" ,
76
- "name" : (
77
- "refactor: A code change that neither fixes "
78
- "a bug nor adds a feature"
95
+ "name" : "refactor: "
96
+ + translate_text_from_eng (
97
+ """A code change that neither fixes a bug nor adds a feature""" ,
98
+ language ,
99
+ "refactor" ,
79
100
),
80
101
"key" : "r" ,
81
102
},
82
103
{
83
104
"value" : "perf" ,
84
- "name" : "perf: A code change that improves performance" ,
105
+ "name" : "perf: "
106
+ + translate_text_from_eng (
107
+ "A code change that improves performance" , language , "perf"
108
+ ),
85
109
"key" : "p" ,
86
110
},
87
111
{
88
112
"value" : "test" ,
89
- "name" : (
90
- "test: Adding missing or correcting " "existing tests"
113
+ "name" : "test: "
114
+ + translate_text_from_eng (
115
+ "Adding missing or correcting existing tests" ,
116
+ language ,
117
+ "test" ,
91
118
),
92
119
"key" : "t" ,
93
120
},
94
121
{
95
122
"value" : "build" ,
96
- "name" : (
97
- "build: Changes that affect the build system or "
98
- "external dependencies (example scopes: pip, docker, npm)"
123
+ "name" : "build: "
124
+ + translate_text_from_eng (
125
+ """Changes that affect the build system or external dependencies (example scopes: pip, docker, npm)""" ,
126
+ language ,
127
+ "build" ,
99
128
),
100
129
"key" : "b" ,
101
130
},
102
131
{
103
132
"value" : "ci" ,
104
- "name" : (
105
- "ci: Changes to CI configuration files and "
106
- "scripts (example scopes: GitLabCI)"
133
+ "name" : "ci: "
134
+ + translate_text_from_eng (
135
+ """Changes to CI configuration files and scripts (example scopes: GitLabCI)""" ,
136
+ language ,
137
+ "ci" ,
107
138
),
108
139
"key" : "c" ,
109
140
},
@@ -112,18 +143,20 @@ def questions(self) -> Questions:
112
143
{
113
144
"type" : "input" ,
114
145
"name" : "scope" ,
115
- "message" : (
116
- "What is the scope of this change? (class or file name): (press [enter] to skip)\n "
146
+ "message" : translate_text_from_eng (
147
+ "What is the scope of this change? (class or file name): (press [enter] to skip)\n " ,
148
+ language ,
149
+ "scope" ,
117
150
),
118
151
"filter" : parse_scope ,
119
152
},
120
153
{
121
154
"type" : "input" ,
122
155
"name" : "subject" ,
123
156
"filter" : parse_subject ,
124
- "message" : (
125
- "Write a short and imperative summary of the code changes: (lower case and no period)\n "
126
- ),
157
+ "message" : translate_text_from_eng (
158
+ "Write a short and imperative summary of the code changes: (lower case and no period)\n " ,
159
+ language , "subject" ),
127
160
},
128
161
{
129
162
"type" : "input" ,
0 commit comments