Skip to content

Commit b70e325

Browse files
committed
kconfig: fix update-po-config
Massimo Maiurana <maiurana@gmail.com> reported that update-po-config was broken: 1) spelling errors in Makefile so arch/um failed 2) UTF-8 was not supported The following patch address the above problems. kxgettext now append the output to the .pot file generated by xgettext - so we have a header. In all places UFT-8 is specifed so we now flawlessly support UTF-8. The Kconfig files had an empty string in a few cases - these are now supressed in kxgettext. With this the translators can now pick up where they left and get it all translated. There are ~11000 strings to be translated... Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Massimo Maiurana <maiurana@gmail.com> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
1 parent 4c6f2eb commit b70e325

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

scripts/kconfig/Makefile

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,25 @@ oldconfig: $(obj)/conf
2222
silentoldconfig: $(obj)/conf
2323
$< -s arch/$(ARCH)/Kconfig
2424

25+
# Create new linux.po file
26+
# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
27+
# The symlink is used to repair a deficiency in arch/um
2528
update-po-config: $(obj)/kxgettext
26-
xgettext --default-domain=linux \
27-
--add-comments --keyword=_ --keyword=N_ \
28-
--files-from=scripts/kconfig/POTFILES.in \
29-
--output scripts/kconfig/config.pot
30-
$(Q)ln -fs Kconfig_i386 arch/um/Kconfig_arch
31-
$(Q)for i in `ls arch/`; \
32-
do \
33-
scripts/kconfig/kxgettext arch/$$i/Kconfig \
34-
| msguniq -o scripts/kconfig/linux_$${i}.pot; \
35-
done
36-
$(Q)msgcat scripts/kconfig/config.pot \
37-
`find scripts/kconfig/ -type f -name linux_*.pot` \
38-
--output scripts/kconfig/linux_raw.pot
39-
$(Q)msguniq --sort-by-file scripts/kconfig/linux_raw.pot \
40-
--output scripts/kconfig/linux.pot
41-
$(Q)rm -f arch/um/Kconfig_arch
42-
$(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot
29+
xgettext --default-domain=linux \
30+
--add-comments --keyword=_ --keyword=N_ \
31+
--from-code=UTF-8 \
32+
--files-from=scripts/kconfig/POTFILES.in \
33+
--output $(obj)/config.pot
34+
$(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot
35+
$(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch
36+
(for i in `ls arch/`; \
37+
do \
38+
$(obj)/kxgettext arch/$$i/Kconfig; \
39+
done ) >> $(obj)/config.pot
40+
msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
41+
--output $(obj)/linux.pot
42+
$(Q)rm -f arch/um/Kconfig.arch
43+
$(Q)rm -f $(obj)/config.pot
4344

4445
PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
4546

scripts/kconfig/kxgettext.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ void menu__xgettext(void)
212212
struct message *m = message__list;
213213

214214
while (m != NULL) {
215-
message__print_gettext_msgid_msgstr(m);
215+
/* skip empty lines ("") */
216+
if (strlen(m->msg) > sizeof("\"\""))
217+
message__print_gettext_msgid_msgstr(m);
216218
m = m->next;
217219
}
218220
}

0 commit comments

Comments
 (0)