33
44from commitizen import defaults
55from commitizen .cz .base import BaseCommitizen
6+ from commitizen .cz .conventional_commits .translation_multilanguage import (
7+ translate_text_from_eng ,
8+ )
69from commitizen .cz .utils import multiple_line_breaker , required_validator
710from commitizen .defaults import Questions
811
@@ -40,70 +43,98 @@ class ConventionalCommitsCz(BaseCommitizen):
4043 }
4144 changelog_pattern = defaults .bump_pattern
4245
43- def questions (self ) -> Questions :
46+ def questions (self , language : str ) -> Questions :
4447 questions : Questions = [
4548 {
4649 "type" : "list" ,
4750 "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+ ),
4954 "choices" : [
5055 {
5156 "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+ ),
5363 "key" : "x" ,
5464 },
5565 {
5666 "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+ ),
5873 "key" : "f" ,
5974 },
6075 {
6176 "value" : "docs" ,
62- "name" : "docs: Documentation only changes" ,
77+ "name" : "docs: "
78+ + translate_text_from_eng (
79+ "Documentation only changes" , language , "docs"
80+ ),
6381 "key" : "d" ,
6482 },
6583 {
6684 "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" ,
7190 ),
7291 "key" : "s" ,
7392 },
7493 {
7594 "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" ,
79100 ),
80101 "key" : "r" ,
81102 },
82103 {
83104 "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+ ),
85109 "key" : "p" ,
86110 },
87111 {
88112 "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" ,
91118 ),
92119 "key" : "t" ,
93120 },
94121 {
95122 "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" ,
99128 ),
100129 "key" : "b" ,
101130 },
102131 {
103132 "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" ,
107138 ),
108139 "key" : "c" ,
109140 },
@@ -112,18 +143,20 @@ def questions(self) -> Questions:
112143 {
113144 "type" : "input" ,
114145 "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" ,
117150 ),
118151 "filter" : parse_scope ,
119152 },
120153 {
121154 "type" : "input" ,
122155 "name" : "subject" ,
123156 "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" ),
127160 },
128161 {
129162 "type" : "input" ,
0 commit comments