1212!ENDIF
1313
1414!IFNDEF LANGUAGE
15- ! IF [powershell.exe -nologo -noprofile $$lng=(Get-UICulture).TwoLetterISOLanguageName;$$Env :LANGUAGE=$$lng;Set-Content -Path .\lng.tmp -Value "LANGUAGE=$$lng"]
16- # ! IF [powershell.exe -nologo -noprofile -command $$Env:LANGUAGE=(Get-UICulture).TwoLetterISOLanguageName ]
15+ ! IF [powershell.exe -nologo -noprofile $$lng=(Get-UICulture).TwoLetterISOLanguageName; \
16+ $$Env:LANGUAGE=$$lng;Set-Content -Path .\lng.tmp -Value "LANGUAGE=$$lng" ]
1717! ENDIF
1818# In order for the "install" and "cleanup-po" rule to work.
1919# The others work with just setting the environment variable.
3030! MESSAGE LANGUAGE is already set "$(LANGUAGE)"
3131!ENDIF
3232
33- # get LANGUAGES, MOFILES, MOCONVERTED and others
33+ # Get LANGUAGES, MOFILES, MOCONVERTED and others.
3434!INCLUDE Make_all.mak
3535
3636!IFNDEF VIMRUNTIME
@@ -46,7 +46,15 @@ VIM = ..\vim.exe
4646# installed. Please do not put the path in quotes.
4747GETTEXT_PATH = D:\Programs\GetText\bin
4848
49+ # Starting from version 0.22, msgfmt forcibly converts text to UTF-8 regardless
50+ # of the value of the "charset" field.
51+ !IF [% comspec% /v :on /e:on /c "for /F "tokens=4 delims= " % G in \
52+ (' "$(GETTEXT_PATH)\msgfmt.exe" --version^|findstr /rc:[0-9^]\.[0-9^][0-9^]' ) do \
53+ @ (set " v=%G" && if ! v:~ 2^,2! GEQ 22 exit /b 1)" ]
54+ MSGFMT = "$(GETTEXT_PATH ) \msgfmt.exe" -v --no-convert
55+ !ELSE
4956MSGFMT = "$(GETTEXT_PATH ) \msgfmt.exe" -v
57+ !ENDIF
5058XGETTEXT = "$(GETTEXT_PATH ) \xgettext.exe"
5159MSGMERGE = "$(GETTEXT_PATH ) \msgmerge.exe"
5260
@@ -55,9 +63,9 @@ MSGMERGE = "$(GETTEXT_PATH)\msgmerge.exe"
5563# If the "iconv" program is installed on the system, but it is not registered
5664# in the %PATH% environment variable, then specify the full path to this file.
5765!IF EXIST ("iconv.exe")
58- ICONV = " iconv.exe"
66+ ICONV = iconv.exe
5967!ELSEIF EXIST ("$(GETTEXT_PATH)\iconv.exe")
60- ICONV = "$(GETTEXT_PATH ) \iconv.exe"
68+ ICONV = "$(GETTEXT_PATH ) \iconv.exe"
6169!ENDIF
6270
6371# In case some package like GnuWin32, UnixUtils
@@ -133,7 +141,7 @@ ja.sjis.po: ja.po
133141sjiscorr : sjiscorr.c
134142 $(CC ) sjiscorr.c
135143
136- # Convert ja.po to create ja.euc-jp.po
144+ # Convert ja.po to create ja.euc-jp.po.
137145ja.euc-jp.po : ja.po
138146 -$(RM ) $@
139147!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
@@ -313,7 +321,7 @@ zh_CN.cp936.po: zh_CN.UTF-8.po
313321 [System.IO.File]::WriteAllText(\"$@\", $$out, \
314322 [System.Text.Encoding]::GetEncoding(20936))
315323
316- # Convert zh_TW.UTF-8.po to create zh_TW.po
324+ # Convert zh_TW.UTF-8.po to create zh_TW.po.
317325zh_TW.po : zh_TW.UTF-8.po
318326 -$(RM ) $@
319327!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
@@ -341,7 +349,7 @@ zh_TW.po: zh_TW.UTF-8.po
341349 [System.IO.File]::WriteAllText(\"$@\", $$out, \
342350 [System.Text.Encoding]::GetEncoding(950))
343351
344- # Convert zh_TW.UTF-8.po to create zh_TW.po with backslash characters
352+ # Convert zh_TW.UTF-8.po to create zh_TW.po with backslash characters.
345353# Requires doubling backslashes in the second byte. Don't depend on big5corr,
346354# it should only be compiled when zh_TW.po is outdated.
347355
@@ -379,7 +387,7 @@ zh_TW.po: zh_TW.UTF-8.po
379387# [System.IO.File]::WriteAllText(\"$@\", $$out, \
380388# [System.Text.Encoding]::GetEncoding(950))
381389
382- # see above in the zh_TW.po conversion section for backslashes.
390+ # See above in the zh_TW.po conversion section for backslashes.
383391# big5corr: big5corr.c
384392# $(CC) big5corr.c
385393
@@ -512,7 +520,7 @@ $(PACKAGE).pot: files
512520# The files that are converted to a different encoding clearly state "DO NOT EDIT".
513521update-po : $(MOFILES:.mo= )
514522
515- # Don't add a dependency here, we only want to update the .po files manually
523+ # Don't add a dependency here, we only want to update the .po files manually.
516524$(LANGUAGES ) :
517525 @$(MAKE ) -nologo -f Make_mvc.mak GETTEXT_PATH=" $( GETTEXT_PATH) " $(PACKAGE ) .pot
518526 $(CP ) $@ .po $@ .po.orig
@@ -521,14 +529,14 @@ $(LANGUAGES):
521529 $(RM ) $@ .po.old
522530
523531install : $(LANGUAGE ) .mo
524- if not exist $( INSTALLDIR) $( MKD) $( INSTALLDIR)
525- $(CP ) $(LANGUAGE ) .mo $(INSTALLDIR ) \$ (PACKAGE).mo
532+ if not exist " $( INSTALLDIR) " $( MKD) " $( INSTALLDIR) "
533+ $(CP ) $(LANGUAGE ) .mo " $( INSTALLDIR) \$ (PACKAGE).mo"
526534
527535install-all : all
528- for %%l in ($( LANGUAGES) ) do @if not exist $( VIMRUNTIME) \l ang\% %l\L C_MESSAGES \
529- $(MKD ) $(VIMRUNTIME ) \l ang\% %l\L C_MESSAGES
536+ for %%l in ($( LANGUAGES) ) do @if not exist " $( VIMRUNTIME) \lang\%%l\LC_MESSAGES" \
537+ $(MKD ) " $( VIMRUNTIME) \lang\%%l\LC_MESSAGES"
530538 for %%l in ($( LANGUAGES) ) do @$( CP) %%l.mo \
531- $(VIMRUNTIME ) \l ang\% %l\L C_MESSAGES\$ (PACKAGE).mo
539+ " $( VIMRUNTIME) \lang\%%l\LC_MESSAGES\$ (PACKAGE).mo"
532540
533541cleanup-po : $(LANGUAGE ) .po
534542 " $( VIM) " -u NONE -e -X -S cleanup.vim -c wq $(LANGUAGE ) .po
0 commit comments