Skip to content

Commit f5575ed

Browse files
committed
Don't build/install non-UTF-8 and encoding-converted locales
Currently a lot of the .po locale files are generated using iconv to different encodings. This is only necessary if the version of Vim does not have iconv and cannot dynamically convert encoding, which isn't the case for MacVim. Furthermore, MacVim should only work in UTF-8 anyway, so it's not useful to have all the other non-UTF-8 locales (e.g. zh_CN.cp936.po) being built and bundled together, as they make the build process more complicated and bulk up the binary size of the app bundle. Simply modify the Makefile to not install / build any of the duplicate locale files. For locales like ko/zh_CN/zh_TW, where the "base" version ko.po is in a non-UTF-8 locale and converted from a ko.UTF-8.po, we keep only the ko.UTF-8.po version, but during install we install the folder as "ko" instead of "ko.UTF-8". This way, if someone somehow set LANG=ko_KR, it will still work instead of having to set LANG=ko_KR.UTF-8. Currently, pl.po is an odd one out because pl.UTF-8.po is actually generated from pl.po, instead of the other way round. We just use pl.po since that's the source version, instead of using the generated UTF-8 one for simplicity (MacVim can handle it fine). Saved ~2 MB in the app bundle, and ~1MB in the generated dmg.
1 parent 4b30143 commit f5575ed

File tree

2 files changed

+73
-48
lines changed

2 files changed

+73
-48
lines changed

src/po/Make_all.mak

Lines changed: 63 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ LANGUAGES = \
66
af \
77
ca \
88
cs \
9-
cs.cp1250 \
109
da \
1110
de \
1211
en_GB \
@@ -17,40 +16,49 @@ LANGUAGES = \
1716
ga \
1817
it \
1918
ja \
20-
ja.euc-jp \
21-
ja.sjis \
22-
ko \
2319
ko.UTF-8 \
2420
lv \
2521
nb \
2622
nl \
2723
no \
2824
pl \
29-
pl.UTF-8 \
30-
pl.cp1250 \
3125
pt_BR \
3226
ru \
33-
ru.cp1251 \
3427
sk \
35-
sk.cp1250 \
3628
sr \
3729
sv \
3830
tr \
3931
uk \
40-
uk.cp1251 \
4132
vi \
42-
zh_CN \
4333
zh_CN.UTF-8 \
44-
zh_CN.cp936 \
45-
zh_TW \
4634
zh_TW.UTF-8 \
4735

36+
# MacVim: Don't bundle non-UTF-8 or encoding converted locale files as we always have iconv
37+
#cs.cp1250 \
38+
#ja.euc-jp \
39+
#ja.sjis \
40+
#ko \
41+
#pl.cp1250 \
42+
#pl.UTF-8 \
43+
#ru.cp1251 \
44+
#sk.cp1250 \
45+
#uk.cp1251 \
46+
#zh_CN \
47+
#zh_CN.cp936 \
48+
#zh_TW \
49+
50+
51+
# MacVim: We removed the non-UTF-8 base locales for these, so we upgrade the
52+
# <locale>.UTF-8 ones as base locales.
53+
LANGUAGES_UTF8_ONLY = \
54+
ko \
55+
zh_CN \
56+
zh_TW \
4857

4958
POFILES = \
5059
af.po \
5160
ca.po \
5261
cs.po \
53-
cs.cp1250.po \
5462
da.po \
5563
de.po \
5664
en_GB.po \
@@ -61,34 +69,37 @@ POFILES = \
6169
ga.po \
6270
it.po \
6371
ja.po \
64-
ja.euc-jp.po \
65-
ja.sjis.po \
66-
ko.po \
6772
ko.UTF-8.po \
6873
lv.po \
6974
nb.po \
7075
nl.po \
7176
no.po \
7277
pl.po \
73-
pl.UTF-8.po \
74-
pl.cp1250.po \
7578
pt_BR.po \
7679
ru.po \
77-
ru.cp1251.po \
7880
sk.po \
79-
sk.cp1250.po \
8081
sr.po \
8182
sv.po \
8283
tr.po \
8384
uk.po \
84-
uk.cp1251.po \
8585
vi.po \
86-
zh_CN.po \
8786
zh_CN.UTF-8.po \
88-
zh_CN.cp936.po \
89-
zh_TW.po \
9087
zh_TW.UTF-8.po \
9188

89+
# MacVim: Don't bundle non-UTF-8 or encoding converted locale files as we always have iconv
90+
#cs.cp1250.po \
91+
#ja.euc-jp.po \
92+
#ja.sjis.po \
93+
#ko.po \
94+
#pl.cp1250.po \
95+
#pl.UTF-8.po \
96+
#ru.cp1251.po \
97+
#sk.cp1250.po \
98+
#uk.cp1251.po \
99+
#zh_CN.po \
100+
#zh_CN.cp936.po \
101+
#zh_TW.po \
102+
92103

93104
MOFILES = \
94105
af.mo \
@@ -123,25 +134,26 @@ MOFILES = \
123134

124135

125136
MOCONVERTED = \
126-
cs.cp1250.mo \
127-
ja.euc-jp.mo \
128-
ja.sjis.mo \
129-
ko.mo \
130-
pl.UTF-8.mo \
131-
pl.cp1250.mo \
132-
ru.cp1251.mo \
133-
sk.cp1250.mo \
134-
uk.cp1251.mo \
135-
zh_CN.mo \
136-
zh_CN.cp936.mo \
137-
zh_TW.mo \
137+
138+
# MacVim: Don't bundle non-UTF-8 or encoding converted locale files as we always have iconv
139+
#cs.cp1250.mo \
140+
#ja.euc-jp.mo \
141+
#ja.sjis.mo \
142+
#ko.mo \
143+
#pl.cp1250.mo \
144+
#pl.UTF-8.mo \
145+
#ru.cp1251.mo \
146+
#sk.cp1250.mo \
147+
#uk.cp1251.mo \
148+
#zh_CN.mo \
149+
#zh_CN.cp936.mo \
150+
#zh_TW.mo \
138151
139152

140153
CHECKFILES = \
141154
af.ck \
142155
ca.ck \
143156
cs.ck \
144-
cs.cp1250.ck \
145157
da.ck \
146158
de.ck \
147159
en_GB.ck \
@@ -152,31 +164,34 @@ CHECKFILES = \
152164
ga.ck \
153165
it.ck \
154166
ja.ck \
155-
ja.euc-jp.ck \
156-
ja.sjis.ck \
157167
ko.UTF-8.ck \
158-
ko.ck \
159168
lv.ck \
160169
nb.ck \
161170
nl.ck \
162171
no.ck \
163-
pl.UTF-8.ck \
164172
pl.ck \
165-
pl.cp1250.ck \
166173
pt_BR.ck \
167174
ru.ck \
168-
ru.cp1251.ck \
169175
sk.ck \
170-
sk.cp1250.ck \
171176
sr.ck \
172177
sv.ck \
173178
tr.ck \
174179
uk.ck \
175-
uk.cp1251.ck \
176180
vi.ck \
177181
zh_CN.UTF-8.ck \
178-
zh_CN.ck \
179-
zh_CN.cp936.ck \
180182
zh_TW.UTF-8.ck \
181-
zh_TW.ck \
183+
184+
# MacVim: Don't bundle non-UTF-8 or encoding converted locale files as we always have iconv
185+
#cs.cp1250.ck \
186+
#ja.euc-jp.ck \
187+
#ja.sjis.ck \
188+
#ko.ck \
189+
#pl.cp1250.ck \
190+
#pl.UTF-8.ck \
191+
#ru.cp1251.ck \
192+
#sk.cp1250.ck \
193+
#uk.cp1251.ck \
194+
#zh_CN.ck \
195+
#zh_CN.cp936.ck \
196+
#zh_TW.ck \
182197

src/po/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ install: $(MOFILES) $(MOCONVERTED)
5555
$(INSTALL_DATA) $$lang.mo $$dir/$(PACKAGE).mo; \
5656
chmod $(FILEMOD) $$dir/$(PACKAGE).mo; \
5757
fi; \
58+
done; \
59+
# MacVim: We remove non-UTF-8 locales as it does not make sense to ship \
60+
# them on macOS. To make sure the base locales like "zh_TW" still works, we \
61+
# move them from the encoding-specific ones like "zh_TW.UTF-8" to "zh_TW"
62+
for lang_utf8_only in $(LANGUAGES_UTF8_ONLY); do \
63+
dir=$(LOCALEDIR)/$$lang_utf8_only; \
64+
if test -x "$$dir"; then \
65+
rm -rf "$$dir"; \
66+
fi; \
67+
mv "$$dir.UTF-8" "$$dir"; \
5868
done
5969

6070
uninstall:

0 commit comments

Comments
 (0)