Skip to content

Commit eaaf310

Browse files
committed
Add pluralization for intword
1 parent 177e2cc commit eaaf310

23 files changed

Lines changed: 1458 additions & 916 deletions

File tree

scripts/update-translations.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
set -e
22

33
# extract new phrases
4-
/usr/local/opt/gettext/bin/xgettext --from-code=UTF-8 -o humanize.pot -k'_' -k'N_' -k'P_:1c,2' -l python src/humanize/*.py
4+
/usr/local/opt/gettext/bin/xgettext --from-code=UTF-8 -o humanize.pot -k'_' -k'N_' -k'P_:1c,2' -k'NS_:1,2' -l python src/humanize/*.py
55

66
for d in src/humanize/locale/*/; do
77
locale="$(basename $d)"

src/humanize/i18n.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,26 @@ def num_name(n):
137137
return message
138138

139139

140+
def ngettext_noop(singular, plural):
141+
"""Mark two strings as pluralized translations without translating them.
142+
143+
Example usage:
144+
```python
145+
CONSTANTS = [ngettext_noop('first', 'firsts'), ngettext_noop('second', 'seconds')]
146+
def num_name(n):
147+
return ngettext(*CONSTANTS[n])
148+
```
149+
150+
Args:
151+
singular (str): Singular text to translate in the future.
152+
plural (str): Plural text to translate in the future.
153+
154+
Returns:
155+
tuple: Original text, unchanged.
156+
"""
157+
return (singular, plural)
158+
159+
140160
def thousands_separator() -> str:
141161
"""Return the thousands separator for a locale, default to comma.
142162

src/humanize/locale/ca_ES/LC_MESSAGES/humanize.po

Lines changed: 80 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ msgid ""
66
msgstr ""
77
"Project-Id-Version: humanize\n"
88
"Report-Msgid-Bugs-To: \n"
9-
"POT-Creation-Date: 2021-04-30 17:01+0300\n"
9+
"POT-Creation-Date: 2021-04-30 22:34+0200\n"
1010
"PO-Revision-Date: 2021-04-09 19:57+0200\n"
1111
"Last-Translator: Jordi Mas i Hernàndez <jmas@softcatala.org>\n"
1212
"Language-Team: Catalan\n"
@@ -17,141 +17,176 @@ msgstr ""
1717
"Plural-Forms: nplurals=2; plural=n!=1;\n"
1818
"X-Generator: Poedit 2.4.1\n"
1919

20-
#: src/humanize/number.py:54
20+
#: src/humanize/number.py:56
2121
msgctxt "0"
2222
msgid "th"
2323
msgstr "º"
2424

25-
#: src/humanize/number.py:55
25+
#: src/humanize/number.py:57
2626
msgctxt "1"
2727
msgid "st"
2828
msgstr "º"
2929

30-
#: src/humanize/number.py:56
30+
#: src/humanize/number.py:58
3131
msgctxt "2"
3232
msgid "nd"
3333
msgstr "º"
3434

35-
#: src/humanize/number.py:57
35+
#: src/humanize/number.py:59
3636
msgctxt "3"
3737
msgid "rd"
3838
msgstr "º"
3939

40-
#: src/humanize/number.py:58
40+
#: src/humanize/number.py:60
4141
msgctxt "4"
4242
msgid "th"
4343
msgstr "º"
4444

45-
#: src/humanize/number.py:59
45+
#: src/humanize/number.py:61
4646
msgctxt "5"
4747
msgid "th"
4848
msgstr "º"
4949

50-
#: src/humanize/number.py:60
50+
#: src/humanize/number.py:62
5151
msgctxt "6"
5252
msgid "th"
5353
msgstr "º"
5454

55-
#: src/humanize/number.py:61
55+
#: src/humanize/number.py:63
5656
msgctxt "7"
5757
msgid "th"
5858
msgstr "º"
5959

60-
#: src/humanize/number.py:62
60+
#: src/humanize/number.py:64
6161
msgctxt "8"
6262
msgid "th"
6363
msgstr "º"
6464

65-
#: src/humanize/number.py:63
65+
#: src/humanize/number.py:65
6666
msgctxt "9"
6767
msgid "th"
6868
msgstr "º"
6969

70-
#: src/humanize/number.py:124
70+
#: src/humanize/number.py:126
7171
msgid "thousand"
72-
msgstr ""
72+
msgid_plural "thousand"
73+
msgstr[0] ""
74+
msgstr[1] ""
7375

74-
#: src/humanize/number.py:125
76+
#: src/humanize/number.py:127
77+
#, fuzzy
7578
msgid "million"
76-
msgstr "milió"
79+
msgid_plural "million"
80+
msgstr[0] "milió"
81+
msgstr[1] "milió"
7782

78-
#: src/humanize/number.py:126
83+
#: src/humanize/number.py:128
84+
#, fuzzy
7985
msgid "billion"
80-
msgstr "mil milions"
86+
msgid_plural "billion"
87+
msgstr[0] "mil milions"
88+
msgstr[1] "mil milions"
8189

82-
#: src/humanize/number.py:127
90+
#: src/humanize/number.py:129
91+
#, fuzzy
8392
msgid "trillion"
84-
msgstr "bilions"
93+
msgid_plural "trillion"
94+
msgstr[0] "bilions"
95+
msgstr[1] "bilions"
8596

86-
#: src/humanize/number.py:128
97+
#: src/humanize/number.py:130
98+
#, fuzzy
8799
msgid "quadrillion"
88-
msgstr "quadrilió"
100+
msgid_plural "quadrillion"
101+
msgstr[0] "quadrilió"
102+
msgstr[1] "quadrilió"
89103

90-
#: src/humanize/number.py:129
104+
#: src/humanize/number.py:131
105+
#, fuzzy
91106
msgid "quintillion"
92-
msgstr "quintillió"
107+
msgid_plural "quintillion"
108+
msgstr[0] "quintillió"
109+
msgstr[1] "quintillió"
93110

94-
#: src/humanize/number.py:130
111+
#: src/humanize/number.py:132
112+
#, fuzzy
95113
msgid "sextillion"
96-
msgstr "sextilió"
114+
msgid_plural "sextillion"
115+
msgstr[0] "sextilió"
116+
msgstr[1] "sextilió"
97117

98-
#: src/humanize/number.py:131
118+
#: src/humanize/number.py:133
119+
#, fuzzy
99120
msgid "septillion"
100-
msgstr "septilió"
121+
msgid_plural "septillion"
122+
msgstr[0] "septilió"
123+
msgstr[1] "septilió"
101124

102-
#: src/humanize/number.py:132
125+
#: src/humanize/number.py:134
126+
#, fuzzy
103127
msgid "octillion"
104-
msgstr "octilió"
128+
msgid_plural "octillion"
129+
msgstr[0] "octilió"
130+
msgstr[1] "octilió"
105131

106-
#: src/humanize/number.py:133
132+
#: src/humanize/number.py:135
133+
#, fuzzy
107134
msgid "nonillion"
108-
msgstr "nonilió"
135+
msgid_plural "nonillion"
136+
msgstr[0] "nonilió"
137+
msgstr[1] "nonilió"
109138

110-
#: src/humanize/number.py:134
139+
#: src/humanize/number.py:136
140+
#, fuzzy
111141
msgid "decillion"
112-
msgstr "decilió"
142+
msgid_plural "decillion"
143+
msgstr[0] "decilió"
144+
msgstr[1] "decilió"
113145

114-
#: src/humanize/number.py:135
146+
#: src/humanize/number.py:137
147+
#, fuzzy
115148
msgid "googol"
116-
msgstr "googol"
149+
msgid_plural "googol"
150+
msgstr[0] "googol"
151+
msgstr[1] "googol"
117152

118-
#: src/humanize/number.py:224
153+
#: src/humanize/number.py:228
119154
msgid "zero"
120155
msgstr "zero"
121156

122-
#: src/humanize/number.py:225
157+
#: src/humanize/number.py:229
123158
msgid "one"
124159
msgstr "un"
125160

126-
#: src/humanize/number.py:226
161+
#: src/humanize/number.py:230
127162
msgid "two"
128163
msgstr "dos"
129164

130-
#: src/humanize/number.py:227
165+
#: src/humanize/number.py:231
131166
msgid "three"
132167
msgstr "tres"
133168

134-
#: src/humanize/number.py:228
169+
#: src/humanize/number.py:232
135170
msgid "four"
136171
msgstr "quatre"
137172

138-
#: src/humanize/number.py:229
173+
#: src/humanize/number.py:233
139174
msgid "five"
140175
msgstr "cinc"
141176

142-
#: src/humanize/number.py:230
177+
#: src/humanize/number.py:234
143178
msgid "six"
144179
msgstr "sis"
145180

146-
#: src/humanize/number.py:231
181+
#: src/humanize/number.py:235
147182
msgid "seven"
148183
msgstr "set"
149184

150-
#: src/humanize/number.py:232
185+
#: src/humanize/number.py:236
151186
msgid "eight"
152187
msgstr "vuit"
153188

154-
#: src/humanize/number.py:233
189+
#: src/humanize/number.py:237
155190
msgid "nine"
156191
msgstr "nou"
157192

0 commit comments

Comments
 (0)