Mercurial > vim
comparison src/po/Makefile @ 21989:52e970719f4b v8.2.1544
patch 8.2.1544: cannot translate messages in a Vim script
Commit: https://github.com/vim/vim/commit/0b39c3fd4c5d1c8ebd2efa85fced7df5e17efd3b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 30 15:52:10 2020 +0200
patch 8.2.1544: cannot translate messages in a Vim script
Problem: Cannot translate messages in a Vim script.
Solution: Add gettext(). Try it out for a few messages in the options
window.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 30 Aug 2020 16:00:04 +0200 |
parents | daa71bf6b546 |
children | aa91480771fe |
comparison
equal
deleted
inserted
replaced
21988:e3a2f5300336 | 21989:52e970719f4b |
---|---|
34 | 34 |
35 all: $(MOFILES) $(MOCONVERTED) $(MSGFMT_DESKTOP) | 35 all: $(MOFILES) $(MOCONVERTED) $(MSGFMT_DESKTOP) |
36 | 36 |
37 check: $(CHECKFILES) | 37 check: $(CHECKFILES) |
38 | 38 |
39 # installing for real | |
39 install: $(MOFILES) $(MOCONVERTED) | 40 install: $(MOFILES) $(MOCONVERTED) |
40 @$(MAKE) prefixcheck | 41 @$(MAKE) prefixcheck |
41 for lang in $(LANGUAGES); do \ | 42 for lang in $(LANGUAGES); do \ |
42 dir=$(LOCALEDIR)/$$lang/; \ | 43 dir=$(LOCALEDIR)/$$lang/; \ |
43 if test ! -x "$$dir"; then \ | 44 if test ! -x "$$dir"; then \ |
59 cat=`basename $$cat`; \ | 60 cat=`basename $$cat`; \ |
60 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ | 61 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ |
61 rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \ | 62 rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \ |
62 done | 63 done |
63 | 64 |
65 # installing for local tryout into ../../runtime/lang | |
66 tryoutinstall: $(MOFILES) $(MOCONVERTED) | |
67 @$(MAKE) prefixcheck | |
68 for lang in $(LANGUAGES); do \ | |
69 dir=../../runtime/lang/$$lang/; \ | |
70 if test ! -x "$$dir"; then \ | |
71 mkdir $$dir; chmod 755 $$dir; \ | |
72 fi; \ | |
73 dir=../../runtime/lang/$$lang/LC_MESSAGES; \ | |
74 if test ! -x "$$dir"; then \ | |
75 mkdir $$dir; chmod 755 $$dir; \ | |
76 fi; \ | |
77 if test -r $$lang.mo; then \ | |
78 cp $$lang.mo $$dir/$(PACKAGE).mo; \ | |
79 chmod 644 $$dir/$(PACKAGE).mo; \ | |
80 fi; \ | |
81 done | |
82 | |
64 converted: $(MOCONVERTED) | 83 converted: $(MOCONVERTED) |
65 | 84 |
66 # nl.po was added later, if it does not exist use a file with just a # in it | 85 # nl.po was added later, if it does not exist use a file with just a # in it |
67 # (an empty file doesn't work with old msgfmt). | 86 # (an empty file doesn't work with old msgfmt). |
68 nl.po: | 87 nl.po: |
156 distclean: clean | 175 distclean: clean |
157 | 176 |
158 checkclean: | 177 checkclean: |
159 rm -f *.ck | 178 rm -f *.ck |
160 | 179 |
161 $(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h ../if_py_both.h ../vim.h gvim.desktop.in vim.desktop.in | 180 PO_INPUTLIST = \ |
162 cd ..; $(XGETTEXT) --default-domain=$(PACKAGE) \ | 181 ../*.c \ |
163 --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 \ | 182 ../if_perl.xs \ |
164 *.c if_perl.xs GvimExt/gvimext.cpp globals.h if_py_both.h vim.h \ | 183 ../GvimExt/gvimext.cpp \ |
165 po/gvim.desktop.in po/vim.desktop.in | 184 ../globals.h \ |
166 mv -f ../$(PACKAGE).po $(PACKAGE).pot | 185 ../if_py_both.h \ |
186 ../vim.h \ | |
187 gvim.desktop.in \ | |
188 vim.desktop.in | |
189 | |
190 PO_VIM_INPUTLIST = \ | |
191 ../../runtime/optwin.vim | |
192 | |
193 PO_VIM_JSLIST = \ | |
194 optwin.js | |
195 | |
196 $(PACKAGE).pot: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST) | |
197 # Convert the Vim scripts to (what looks like) Javascript | |
198 $(VIM) -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST) | |
199 # create vim.pot | |
200 $(XGETTEXT) --default-domain=$(PACKAGE) --add-comments \ | |
201 --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 \ | |
202 $(PO_INPUTLIST) $(PO_VIM_JSLIST) | |
203 mv -f $(PACKAGE).po $(PACKAGE).pot | |
204 # Fix Vim scripts names, so that "gf" works | |
205 $(VIM) -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST) | |
206 # Delete the temporary files | |
207 rm *.js | |
167 | 208 |
168 vim.desktop: vim.desktop.in $(POFILES) | 209 vim.desktop: vim.desktop.in $(POFILES) |
169 echo $(LANGUAGES) | tr " " "\n" |sed -e '/\./d' | sort > LINGUAS | 210 echo $(LANGUAGES) | tr " " "\n" |sed -e '/\./d' | sort > LINGUAS |
170 $(MSGFMT) --desktop -d . --template vim.desktop.in -o tmp_vim.desktop | 211 $(MSGFMT) --desktop -d . --template vim.desktop.in -o tmp_vim.desktop |
171 rm -f LINGUAS | 212 rm -f LINGUAS |