From a9d58107e5ef9d603ff0eaa007c8ef6c86035d60 Mon Sep 17 00:00:00 2001 From: Yee Cheng Chin Date: Sun, 19 Mar 2023 18:38:22 -0700 Subject: [PATCH] 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). Also, revert the MacVim-local translations made to these non-UTF8 locales like zh_CN.cp936.po, since we don't use them anymore in MacVim builds. Saved ~2 MB in the app bundle, and ~1MB in the generated dmg. --- src/po/Make_all.mak | 111 ++++++++++++++++++++++++------------------ src/po/Makefile | 10 ++++ src/po/ja.euc-jp.po | 8 --- src/po/ja.sjis.po | 8 --- src/po/zh_CN.cp936.po | 8 --- src/po/zh_CN.po | 8 --- src/po/zh_TW.po | 8 --- 7 files changed, 73 insertions(+), 88 deletions(-) diff --git a/src/po/Make_all.mak b/src/po/Make_all.mak index 89cbb151bb..24e963353a 100644 --- a/src/po/Make_all.mak +++ b/src/po/Make_all.mak @@ -6,7 +6,6 @@ LANGUAGES = \ af \ ca \ cs \ - cs.cp1250 \ da \ de \ en_GB \ @@ -17,40 +16,49 @@ LANGUAGES = \ ga \ it \ ja \ - ja.euc-jp \ - ja.sjis \ - ko \ ko.UTF-8 \ lv \ nb \ nl \ no \ pl \ - pl.UTF-8 \ - pl.cp1250 \ pt_BR \ ru \ - ru.cp1251 \ sk \ - sk.cp1250 \ sr \ sv \ tr \ uk \ - uk.cp1251 \ vi \ - zh_CN \ zh_CN.UTF-8 \ - zh_CN.cp936 \ - zh_TW \ zh_TW.UTF-8 \ +# MacVim: Don't bundle non-UTF-8 or encoding converted locale files as we always have iconv + #cs.cp1250 \ + #ja.euc-jp \ + #ja.sjis \ + #ko \ + #pl.cp1250 \ + #pl.UTF-8 \ + #ru.cp1251 \ + #sk.cp1250 \ + #uk.cp1251 \ + #zh_CN \ + #zh_CN.cp936 \ + #zh_TW \ + + +# MacVim: We removed the non-UTF-8 base locales for these, so we upgrade the +# .UTF-8 ones as base locales. +LANGUAGES_UTF8_ONLY = \ + ko \ + zh_CN \ + zh_TW \ POFILES = \ af.po \ ca.po \ cs.po \ - cs.cp1250.po \ da.po \ de.po \ en_GB.po \ @@ -61,34 +69,37 @@ POFILES = \ ga.po \ it.po \ ja.po \ - ja.euc-jp.po \ - ja.sjis.po \ - ko.po \ ko.UTF-8.po \ lv.po \ nb.po \ nl.po \ no.po \ pl.po \ - pl.UTF-8.po \ - pl.cp1250.po \ pt_BR.po \ ru.po \ - ru.cp1251.po \ sk.po \ - sk.cp1250.po \ sr.po \ sv.po \ tr.po \ uk.po \ - uk.cp1251.po \ vi.po \ - zh_CN.po \ zh_CN.UTF-8.po \ - zh_CN.cp936.po \ - zh_TW.po \ zh_TW.UTF-8.po \ +# MacVim: Don't bundle non-UTF-8 or encoding converted locale files as we always have iconv + #cs.cp1250.po \ + #ja.euc-jp.po \ + #ja.sjis.po \ + #ko.po \ + #pl.cp1250.po \ + #pl.UTF-8.po \ + #ru.cp1251.po \ + #sk.cp1250.po \ + #uk.cp1251.po \ + #zh_CN.po \ + #zh_CN.cp936.po \ + #zh_TW.po \ + MOFILES = \ af.mo \ @@ -123,25 +134,26 @@ MOFILES = \ MOCONVERTED = \ - cs.cp1250.mo \ - ja.euc-jp.mo \ - ja.sjis.mo \ - ko.mo \ - pl.UTF-8.mo \ - pl.cp1250.mo \ - ru.cp1251.mo \ - sk.cp1250.mo \ - uk.cp1251.mo \ - zh_CN.mo \ - zh_CN.cp936.mo \ - zh_TW.mo \ + +# MacVim: Don't bundle non-UTF-8 or encoding converted locale files as we always have iconv + #cs.cp1250.mo \ + #ja.euc-jp.mo \ + #ja.sjis.mo \ + #ko.mo \ + #pl.cp1250.mo \ + #pl.UTF-8.mo \ + #ru.cp1251.mo \ + #sk.cp1250.mo \ + #uk.cp1251.mo \ + #zh_CN.mo \ + #zh_CN.cp936.mo \ + #zh_TW.mo \ CHECKFILES = \ af.ck \ ca.ck \ cs.ck \ - cs.cp1250.ck \ da.ck \ de.ck \ en_GB.ck \ @@ -152,31 +164,34 @@ CHECKFILES = \ ga.ck \ it.ck \ ja.ck \ - ja.euc-jp.ck \ - ja.sjis.ck \ ko.UTF-8.ck \ - ko.ck \ lv.ck \ nb.ck \ nl.ck \ no.ck \ - pl.UTF-8.ck \ pl.ck \ - pl.cp1250.ck \ pt_BR.ck \ ru.ck \ - ru.cp1251.ck \ sk.ck \ - sk.cp1250.ck \ sr.ck \ sv.ck \ tr.ck \ uk.ck \ - uk.cp1251.ck \ vi.ck \ zh_CN.UTF-8.ck \ - zh_CN.ck \ - zh_CN.cp936.ck \ zh_TW.UTF-8.ck \ - zh_TW.ck \ + +# MacVim: Don't bundle non-UTF-8 or encoding converted locale files as we always have iconv + #cs.cp1250.ck \ + #ja.euc-jp.ck \ + #ja.sjis.ck \ + #ko.ck \ + #pl.cp1250.ck \ + #pl.UTF-8.ck \ + #ru.cp1251.ck \ + #sk.cp1250.ck \ + #uk.cp1251.ck \ + #zh_CN.ck \ + #zh_CN.cp936.ck \ + #zh_TW.ck \ diff --git a/src/po/Makefile b/src/po/Makefile index 9dfbc34e74..596fd25e0f 100644 --- a/src/po/Makefile +++ b/src/po/Makefile @@ -55,6 +55,16 @@ install: $(MOFILES) $(MOCONVERTED) $(INSTALL_DATA) $$lang.mo $$dir/$(PACKAGE).mo; \ chmod $(FILEMOD) $$dir/$(PACKAGE).mo; \ fi; \ + done; \ + # MacVim: We remove non-UTF-8 locales as it does not make sense to ship \ + # them on macOS. To make sure the base locales like "zh_TW" still works, we \ + # move them from the encoding-specific ones like "zh_TW.UTF-8" to "zh_TW" + for lang_utf8_only in $(LANGUAGES_UTF8_ONLY); do \ + dir=$(LOCALEDIR)/$$lang_utf8_only; \ + if test -x "$$dir"; then \ + rm -rf "$$dir"; \ + fi; \ + mv "$$dir.UTF-8" "$$dir"; \ done uninstall: diff --git a/src/po/ja.euc-jp.po b/src/po/ja.euc-jp.po index f6529bc468..3bec1d3a21 100644 --- a/src/po/ja.euc-jp.po +++ b/src/po/ja.euc-jp.po @@ -3503,10 +3503,6 @@ msgstr "with Photon GUI." msgid "with GUI." msgstr "with GUI." -# MacVim only -msgid "with MacVim GUI." -msgstr "with MacVim GUI." - msgid " Features included (+) or not (-):\n" msgstr " ��ǽ�ΰ��� ͭ��(+)/̵��(-)\n" @@ -3588,10 +3584,6 @@ msgstr " msgid "type :help or for on-line help" msgstr "����饤��إ�פ� :help �� " -# MacVim only -msgid "type :help macvim for MacVim help " -msgstr "MacVim �Υ���饤��إ�פ� :help macvim " - msgid "type :help version9 for version info" msgstr "�С���������� :help version9 " diff --git a/src/po/ja.sjis.po b/src/po/ja.sjis.po index c56f4241d9..f554976998 100644 --- a/src/po/ja.sjis.po +++ b/src/po/ja.sjis.po @@ -3503,10 +3503,6 @@ msgstr "with Photon GUI." msgid "with GUI." msgstr "with GUI." -# MacVim only -msgid "with MacVim GUI." -msgstr "with MacVim GUI." - msgid " Features included (+) or not (-):\n" msgstr " �@�\\�̈ꗗ �L��(+)/����(-)\n" @@ -3588,10 +3584,6 @@ msgstr " msgid "type :help or for on-line help" msgstr "�I�����C���w���v�� :help �� " -# MacVim only -msgid "type :help macvim for MacVim help " -msgstr "MacVim �̃I�����C���w���v�� :help macvim " - msgid "type :help version9 for version info" msgstr "�o�[�W�������� :help version9 " diff --git a/src/po/zh_CN.cp936.po b/src/po/zh_CN.cp936.po index 91d03fbc68..bbbe4f7f1c 100644 --- a/src/po/zh_CN.cp936.po +++ b/src/po/zh_CN.cp936.po @@ -3474,10 +3474,6 @@ msgstr " msgid "with GUI." msgstr "��ͼ�ν��档" -# MacVim only -msgid "with MacVim GUI." -msgstr "�� MacVim ͼ�ν��档" - msgid " Features included (+) or not (-):\n" msgstr " ��ʹ��(+)�벻��ʹ��(-)�Ĺ���:\n" @@ -3559,10 +3555,6 @@ msgstr " msgid "type :help or for on-line help" msgstr "���� :help �� �鿴���߰��� " -# MacVim only -msgid "type :help macvim for MacVim help " -msgstr " ���� :help macvim �鿴 MacVim �����߰���" - msgid "type :help version9 for version info" msgstr "���� :help version9 �鿴�汾��Ϣ " diff --git a/src/po/zh_CN.po b/src/po/zh_CN.po index 2a1e487a74..3d7b808f47 100644 --- a/src/po/zh_CN.po +++ b/src/po/zh_CN.po @@ -3474,10 +3474,6 @@ msgstr " msgid "with GUI." msgstr "��ͼ�ν��档" -# MacVim only -msgid "with MacVim GUI." -msgstr "�� MacVim ͼ�ν��档" - msgid " Features included (+) or not (-):\n" msgstr " ��ʹ��(+)�벻��ʹ��(-)�Ĺ���:\n" @@ -3559,10 +3555,6 @@ msgstr " msgid "type :help or for on-line help" msgstr "���� :help �� �鿴���߰��� " -# MacVim only -msgid "type :help macvim for MacVim help " -msgstr " ���� :help macvim �鿴 MacVim �����߰���" - msgid "type :help version9 for version info" msgstr "���� :help version9 �鿴�汾��Ϣ " diff --git a/src/po/zh_TW.po b/src/po/zh_TW.po index e87a9bbea8..51589a7759 100644 --- a/src/po/zh_TW.po +++ b/src/po/zh_TW.po @@ -4714,10 +4714,6 @@ msgstr " msgid "with Cocoa GUI." msgstr "�ϥ� Cocoa �ϫ��ɭ��C" -# MacVim only -msgid "with MacVim GUI." -msgstr "�ϥ� MacVim �ϫ��ɭ��C" - msgid "with (classic) GUI." msgstr "�ϥ� (�Dz�) �ϫ��ɭ��C" @@ -4799,10 +4795,6 @@ msgstr " msgid "type :help or for on-line help" msgstr "�u�W�����п�J :help " -# MacVim only -msgid "type :help macvim for MacVim help " -msgstr "MacVim �u�W�����п�J :help " - msgid "type :help version9 for version info" msgstr "�s������T�п�J :help version9"