diff options
author | RestorerZ <restorer@mail2k.ru> | 2024-01-22 20:28:12 +0100 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-01-22 20:38:38 +0100 |
commit | 76ba724e1d56b00e72834a9203855f0656dcbb58 (patch) | |
tree | 07ae99ab11d5d51e31379833dbe41eb534cca795 | |
parent | 91155eb31fbb344b8407664cd8d25d907eda6969 (diff) |
patch 9.1.0044: po Makefiles can be improvedv9.1.0044
Problem: po Makefiles can be improved
Solution: Improve the style of the Makefiles, update
Makefile variables, update documentation
(RestorerZ)
closes: #13858
closes: #13857
Signed-off-by: RestorerZ <restorer@mail2k.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r-- | src/Makefile | 2 | ||||
-rw-r--r-- | src/po/Make_mvc.mak | 204 | ||||
-rw-r--r-- | src/po/Makefile | 113 | ||||
-rw-r--r-- | src/po/README.txt | 13 | ||||
-rw-r--r-- | src/po/README_mingw.txt | 6 | ||||
-rw-r--r-- | src/po/README_mvc.txt | 52 | ||||
-rw-r--r-- | src/version.c | 2 |
7 files changed, 203 insertions, 189 deletions
diff --git a/src/Makefile b/src/Makefile index 59511d2b34..33903d3d35 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2070,7 +2070,7 @@ xxd/xxd$(EXEEXT): xxd/xxd.c languages: @if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \ cd $(PODIR); \ - CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix); \ + CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix) originals; \ fi -@if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \ cd $(PODIR); \ diff --git a/src/po/Make_mvc.mak b/src/po/Make_mvc.mak index eaf68670b7..1387c338b2 100644 --- a/src/po/Make_mvc.mak +++ b/src/po/Make_mvc.mak @@ -1,15 +1,35 @@ # Makefile for the Vim message translations for MSVC # (based on make_ming.mak) # -# Mike Williams <mrw@eandem.co.uk> +# Mike Williams, <mrw@eandem.co.uk> +# 06.01.24, Restorer, <restorer@mail2k.ru> # # Please read README_mvc.txt before using this file. # -!IF [powershell -nologo -noprofile "exit $$psversiontable.psversion.major"] == 2 +!IF [powershell.exe -nologo -noprofile "exit $$psversiontable.psversion.major"] == 2 !ERROR The program "PowerShell" version 3.0 or higher is required to work !ENDIF +!IFNDEF LANGUAGE +! IF [powershell.exe -nologo -noprofile $$lng=(Get-UICulture).TwoLetterISOLanguageName;$$Env:LANGUAGE=$$lng;Set-Content -Path .\lng.tmp -Value "LANGUAGE=$$lng"] +#! IF [powershell.exe -nologo -noprofile -command $$Env:LANGUAGE=(Get-UICulture).TwoLetterISOLanguageName] +! ENDIF +# In order for the "install" and "cleanup-po" rule to work. +# The others work with just setting the environment variable. +# And to show in the message. +! INCLUDE lng.tmp +! IF [del /q .\lng.tmp] +! ENDIF +! MESSAGE +! MESSAGE The %LANGUAGE% environment variable is not set. +! MESSAGE This variable will be temporarily set to "$(LANGUAGE)" while "nmake.exe" is running. +! MESSAGE See README_mvc.txt for more information on the %LANGUAGE% environment variable. +! MESSAGE +!ELSE +! MESSAGE LANGUAGE is already set "$(LANGUAGE)" +!ENDIF + # get LANGUAGES, MOFILES, MOCONVERTED and others !INCLUDE Make_all.mak @@ -18,16 +38,17 @@ VIMRUNTIME = ..\..\runtime !ENDIF PACKAGE = vim -# Correct the following line for the where executeable file vim is installed. -VIM = ..\vim +# Correct the following line for the where executeable file vim is +# installed. Please do not put the path in quotes. +VIM = ..\vim.exe # Correct the following line for the directory where gettext et al is # installed. Please do not put the path in quotes. GETTEXT_PATH = D:\Programs\GetText\bin -MSGFMT = "$(GETTEXT_PATH)\msgfmt" -v -XGETTEXT = "$(GETTEXT_PATH)\xgettext" -MSGMERGE = "$(GETTEXT_PATH)\msgmerge" +MSGFMT = "$(GETTEXT_PATH)\msgfmt.exe" -v +XGETTEXT = "$(GETTEXT_PATH)\xgettext.exe" +MSGMERGE = "$(GETTEXT_PATH)\msgmerge.exe" # In case some package like GnuWin32, UnixUtils, gettext # or something similar is installed on the system. @@ -54,8 +75,10 @@ CP = copy /y RM = del /q MKD = mkdir LS = dir +PS = PowerShell.exe LSFLAGS = /b /on /l /s +PSFLAGS = -NoLogo -NoProfile -Command INSTALLDIR = $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES @@ -64,8 +87,12 @@ INSTALLDIR = $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES all: $(MOFILES) $(MOCONVERTED) +originals : $(MOFILES) + +converted: $(MOCONVERTED) + .po.ck: - $(VIM) -u NONE --noplugins -e -s -X --cmd "set enc=utf-8" -S check.vim \ + "$(VIM)" -u NONE --noplugins -e -s -X --cmd "set enc=utf-8" -S check.vim \ -c "if error == 0 | q | else | num 2 | cq | endif" $< $(TOUCH_TARGET) @@ -74,13 +101,8 @@ check: $(CHECKFILES) checkclean: $(RM) *.ck -converted: $(MOCONVERTED) - -checklanguage: - @if "$(LANGUAGE)"=="" (echo Set the environment variable ^%LANGUAGE^%. See README_mvc.txt. && exit 1) - nl.po: - @( echo \# > nl.po ) + @( echo ^# >> nl.po ) # Norwegian/Bokmal: "nb" is an alias for "no". nb.po: no.po @@ -95,16 +117,14 @@ ja.sjis.po: ja.po !ELSEIF DEFINED (ICONV) $(ICONV) -f UTF-8 -t CP932 $? | .\sjiscorr.exe > $@ !ELSE - powershell -nologo -noprofile -Command \ - [System.IO.File]::WriteAllText(\"$@\", \ + $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \ [System.IO.File]::ReadAllText(\"$?\", \ [System.Text.Encoding]::GetEncoding(65001)), \ [System.Text.Encoding]::GetEncoding(932)) type $@ | .\sjiscorr.exe > tmp.$@ @$(MV) tmp.$@ $@ !ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(932)) \ -replace \"`r`n\", \"`n\"; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ @@ -122,24 +142,21 @@ ja.euc-jp.po: ja.po ! IF DEFINED (ICONV) $(ICONV) -f UTF-8 -t EUC-JP $? > $@ ! ELSE - powershell -nologo -noprofile -Command \ - [System.IO.File]::WriteAllText(\"$@\", \ + $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \ [System.IO.File]::ReadAllText(\"$?\", \ [System.Text.Encoding]::GetEncoding(65001)), \ [System.Text.Encoding]::GetEncoding(20932)) ! ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(20932)) -replace \ 'charset=utf-8', 'charset=EUC-JP'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(20932)) !ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(20932)) -replace \ '# Original translations', \ - '# Generated from ja.po, DO NOT EDIT'; \ + '# Generated from $?, DO NOT EDIT'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(20932)) @@ -152,24 +169,21 @@ cs.cp1250.po: cs.po ! IF DEFINED (ICONV) $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@ ! ELSE - powershell -nologo -noprofile -Command \ - [System.IO.File]::WriteAllText(\"$@\", \ + $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \ [System.IO.File]::ReadAllText(\"$?\", \ [System.Text.Encoding]::GetEncoding(28592)), \ [System.Text.Encoding]::GetEncoding(1250)) ! ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(1250)) -replace \ 'charset=iso-8859-2', 'charset=CP1250'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(1250)) !ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(1250)) -replace \ '# Original translations', \ - '# Generated from cs.po, DO NOT EDIT'; \ + '# Generated from $?, DO NOT EDIT'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(1250)) @@ -182,24 +196,21 @@ pl.cp1250.po: pl.po ! IF DEFINED (ICONV) $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@ ! ELSE - powershell -nologo -noprofile -Command \ - [System.IO.File]::WriteAllText(\"$@\", \ + $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \ [System.IO.File]::ReadAllText(\"$?\", \ [System.Text.Encoding]::GetEncoding(28592)), \ [System.Text.Encoding]::GetEncoding(1250)) ! ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(1250)) -replace \ 'charset=iso-8859-2', 'charset=CP1250'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(1250)) !ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(1250)) -replace \ '# Original translations', \ - '# Generated from pl.po, DO NOT EDIT'; \ + '# Generated from $?, DO NOT EDIT'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(1250)) @@ -212,20 +223,17 @@ pl.UTF-8.po: pl.po ! IF DEFINED (ICONV) $(ICONV) -f ISO-8859-2 -t UTF-8 $? > $@ ! ELSE - powershell -nologo -noprofile -Command \ - [System.IO.File]::WriteAllText(\"$@\", \ + $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \ [System.IO.File]::ReadAllText(\"$?\", \ [System.Text.Encoding]::GetEncoding(28592))) ! ENDIF - powershell -nologo -noprofile -Command \ - (Get-Content -Raw -Encoding UTF8 $@ \ + $(PS) $(PSFLAGS) (Get-Content -Raw -Encoding UTF8 $@ \ ^| % {$$_-replace 'charset=iso-8859-2', 'charset=UTF-8'}) \ ^| 1>nul New-Item -Force -Path . -ItemType file -Name $@ !ENDIF - powershell -nologo -noprofile -Command \ - (Get-Content -Raw -Encoding UTF8 $@ \ + $(PS) $(PSFLAGS) (Get-Content -Raw -Encoding UTF8 $@ \ ^| % {$$_-replace '# Original translations', \ - '# Generated from pl.po, DO NOT EDIT'}) \ + '# Generated from $?, DO NOT EDIT'}) \ ^| 1>nul New-Item -Force -Path . -ItemType file -Name $@ # Convert sk.po to create sk.cp1250.po. @@ -237,24 +245,21 @@ sk.cp1250.po: sk.po ! IF DEFINED (ICONV) $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@ ! ELSE - powershell -nologo -noprofile -Command \ - [System.IO.File]::WriteAllText(\"$@\", \ + $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \ [System.IO.File]::ReadAllText(\"$?\", \ [System.Text.Encoding]::GetEncoding(28592)), \ [System.Text.Encoding]::GetEncoding(1250)) ! ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(1250)) -replace \ 'charset=iso-8859-2', 'charset=CP1250'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(1250)) !ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(1250)) -replace \ '# Original translations', \ - '# Generated from sk.po, DO NOT EDIT'; \ + '# Generated from $?, DO NOT EDIT'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(1250)) @@ -267,25 +272,22 @@ zh_CN.po: zh_CN.UTF-8.po ! IF DEFINED (ICONV) $(ICONV) -f UTF-8 -t GB2312 $? > $@ ! ELSE - powershell -nologo -noprofile -Command \ - [System.IO.File]::WriteAllText(\"$@\", \ + $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \ [System.IO.File]::ReadAllText(\"$?\", \ [System.Text.Encoding]::GetEncoding(65001)), \ [System.Text.Encoding]::GetEncoding(936)) ! ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(936)) -replace \ 'charset=UTF-8', 'charset=GB2312'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(936)) !ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(936)) -replace \ '# Original translations', \ - '# Generated from zh_CN.UTF-8.po, DO NOT EDIT'; \ + '# Generated from $?, DO NOT EDIT'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(936)) @@ -297,19 +299,17 @@ zh_CN.cp936.po: zh_CN.UTF-8.po !IF DEFINED (ICONV) $(ICONV) -f UTF-8 -t CP936 $? > $@ !ELSE - powershell -nologo -noprofile -Command \ - [System.IO.File]::WriteAllText(\"$@\", \ + $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \ [System.IO.File]::ReadAllText(\"$?\", \ [System.Text.Encoding]::GetEncoding(65001)), \ [System.Text.Encoding]::GetEncoding(20936)) !ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(20936)) \ -replace 'charset=UTF-8', 'charset=GBK'\ -replace '# Original translations', \ - '# Generated from zh_CN.UTF-8.po, DO NOT EDIT'; \ + '# Generated from $?, DO NOT EDIT'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(20936)) @@ -322,31 +322,29 @@ zh_TW.po: zh_TW.UTF-8.po ! IF DEFINED (ICONV) $(ICONV) -f UTF-8 -t BIG5 $? > $@ ! ELSE - powershell -nologo -noprofile -Command \ - [System.IO.File]::WriteAllText(\"$@\", \ + $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \ [System.IO.File]::ReadAllText(\"$?\", \ [System.Text.Encoding]::GetEncoding(65001)), \ [System.Text.Encoding]::GetEncoding(950)) ! ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(950)) -replace \ 'charset=UTF-8', 'charset=BIG5'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(950)) !ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(950)) -replace \ '# Original translations', \ - '# Generated from zh_TW.UTF-8.po, DO NOT EDIT'; \ + '# Generated from $?, DO NOT EDIT'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(950)) # Convert zh_TW.UTF-8.po to create zh_TW.po with backslash characters # Requires doubling backslashes in the second byte. Don't depend on big5corr, # it should only be compiled when zh_TW.po is outdated. + # # 06.11.23, added by Restorer: # For more details, see: @@ -368,16 +366,14 @@ zh_TW.po: zh_TW.UTF-8.po #!ELSEIF DEFINED (ICONV) # $(ICONV) -f UTF-8 -t BIG5 $? | .\big5corr.exe > $@ #!ELSE -# powershell -nologo -noprofile -Command \ -# [System.IO.File]::WriteAllText(\"$@\", \ +# $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \ # [System.IO.File]::ReadAllText(\"$?\", \ # [System.Text.Encoding]::GetEncoding(65001)), \ # [System.Text.Encoding]::GetEncoding(950)) # type $@ | .\big5corr.exe > tmp.$@ # @$(MV) tmp.$@ $@ #!ENDIF -# powershell -nologo -noprofile -Command \ -# $$out = [System.IO.File]::ReadAllText(\"$@\", \ +# $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ # [System.Text.Encoding]::GetEncoding(950)) \ # -replace \"`r`n\", \"`n\"; \ # [System.IO.File]::WriteAllText(\"$@\", $$out, \ @@ -396,25 +392,22 @@ ko.po: ko.UTF-8.po ! IF DEFINED (ICONV) $(ICONV) -f UTF-8 -t EUC-KR $? > $@ ! ELSE - powershell -nologo -noprofile -Command \ - [System.IO.File]::WriteAllText(\"$@\", \ + $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \ [System.IO.File]::ReadAllText(\"$?\", \ [System.Text.Encoding]::GetEncoding(65001)), \ [System.Text.Encoding]::GetEncoding(51949)) ! ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(51949)) -replace \ 'charset=UTF-8', 'charset=EUC-KR'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(51949)) !ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(51949)) -replace \ '# Original translations', \ - '# Generated from ko.UTF-8.po, DO NOT EDIT'; \ + '# Generated from $?, DO NOT EDIT'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(51949)) @@ -427,25 +420,22 @@ ru.cp1251.po: ru.po ! IF DEFINED (ICONV) $(ICONV) -f UTF-8 -t CP1251 $? > $@ ! ELSE - powershell -nologo -noprofile -Command \ - [System.IO.File]::WriteAllText(\"$@\", \ + $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \ [System.IO.File]::ReadAllText(\"$?\", \ [System.Text.Encoding]::GetEncoding(65001)), \ [System.Text.Encoding]::GetEncoding(1251)) ! ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(1251)) -replace \ 'charset=UTF-8', 'charset=CP1251'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(1251)) !ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(1251)) -replace \ '# Original translations', \ - '# Generated from ru.po, DO NOT EDIT'; \ + '# Generated from $?, DO NOT EDIT'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(1251)) @@ -458,25 +448,22 @@ uk.cp1251.po: uk.po ! IF DEFINED (ICONV) $(ICONV) -f UTF-8 -t CP1251 $? > $@ ! ELSE - powershell -nologo -noprofile -Command \ - [System.IO.File]::WriteAllText(\"$@\", \ + $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \ [System.IO.File]::ReadAllText(\"$?\", \ [System.Text.Encoding]::GetEncoding(65001)), \ [System.Text.Encoding]::GetEncoding(1251)) ! ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(1251)) -replace \ 'charset=UTF-8', 'charset=CP1251'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(1251)) !ENDIF - powershell -nologo -noprofile -Command \ - $$out = [System.IO.File]::ReadAllText(\"$@\", \ + $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \ [System.Text.Encoding]::GetEncoding(1251)) -replace \ '# Original translations', \ - '# Generated from uk.po, DO NOT EDIT'; \ + '# Generated from $?, DO NOT EDIT'; \ [System.IO.File]::WriteAllText(\"$@\", $$out, \ [System.Text.Encoding]::GetEncoding(1251)) @@ -498,42 +485,42 @@ PO_INPUTLIST = \ files: $(PO_INPUTLIST) $(LS) $(LSFLAGS) $(PO_INPUTLIST) > .\files -first_time: checklanguage files - $(VIM) -u NONE --not-a-term -S tojavascript.vim $(LANGUAGE).po \ +first_time: files + "$(VIM)" -u NONE --not-a-term -S tojavascript.vim $(LANGUAGE).po \ $(PO_VIM_INPUTLIST) set OLD_PO_FILE_INPUT=yes set OLD_PO_FILE_OUTPUT=yes $(XGETTEXT) --default-domain=$(LANGUAGE) --add-comments $(XGETTEXT_KEYWORDS) \ --files-from=.\files $(PO_VIM_JSLIST) - $(VIM) -u NONE --not-a-term -S fixfilenames.vim $(LANGUAGE).po \ + "$(VIM)" -u NONE --not-a-term -S fixfilenames.vim $(LANGUAGE).po \ $(PO_VIM_INPUTLIST) $(RM) *.js $(PACKAGE).pot: files - $(VIM) -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot \ + "$(VIM)" -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot \ $(PO_VIM_INPUTLIST) set OLD_PO_FILE_INPUT=yes set OLD_PO_FILE_OUTPUT=yes $(XGETTEXT) --default-domain=$(PACKAGE) --add-comments $(XGETTEXT_KEYWORDS) \ --files-from=.\files $(PO_VIM_JSLIST) $(MV) $(PACKAGE).po $(PACKAGE).pot - $(VIM) -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot \ + "$(VIM)" -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot \ $(PO_VIM_INPUTLIST) $(RM) *.js -# When updating ja.sjis.po there are a bunch of errors and a crash. +# Only original translations with default encoding should be updated. # The files that are converted to a different encoding clearly state "DO NOT EDIT". update-po: $(MOFILES:.mo=) # Don't add a dependency here, we only want to update the .po files manually $(LANGUAGES): - @$(MAKE) -nologo -f Make_mvc.mak $(PACKAGE).pot GETTEXT_PATH="$(GETTEXT_PATH)" + @$(MAKE) -nologo -f Make_mvc.mak GETTEXT_PATH="$(GETTEXT_PATH)" $(PACKAGE).pot $(CP) $@.po $@.po.orig $(MV) $@.po $@.po.old $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po $(RM) $@.po.old -install: checklanguage $(LANGUAGE).mo +install: $(LANGUAGE).mo if not exist $(INSTALLDIR) $(MKD) $(INSTALLDIR) $(CP) $(LANGUAGE).mo $(INSTALLDIR)\$(PACKAGE).mo @@ -543,15 +530,16 @@ install-all: all for %%l in ($(LANGUAGES)) do @$(CP) %%l.mo \ $(VIMRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo -cleanup-po: checklanguage $(LANGUAGE).po - $(VIM) -u NONE -e -X -S cleanup.vim -c wq $(LANGUAGE).po +cleanup-po: $(LANGUAGE).po + "$(VIM)" -u NONE -e -X -S cleanup.vim -c wq $(LANGUAGE).po cleanup-po-all: $(POFILES) - !$(VIM) -u NONE -e -X -S cleanup.vim -c wq $** + !"$(VIM)" -u NONE -e -X -S cleanup.vim -c wq $** clean: checkclean $(RM) *.mo $(RM) *.pot + $(RM) *.orig $(RM) files $(RM) sjiscorr.obj sjiscorr.exe # $(RM) big5corr.obj big5corr.exe diff --git a/src/po/Makefile b/src/po/Makefile index 24f8104449..b1144ba680 100644 --- a/src/po/Makefile +++ b/src/po/Makefile @@ -26,7 +26,14 @@ MSGMERGE = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes msgmerge .SUFFIXES: .SUFFIXES: .po .mo .pot .ck -.PHONY: all install uninstall prefixcheck converted check clean checkclean distclean update-po $(LANGUAGES) +.PHONY: all install uninstall prefixcheck originals converted check clean \ + checkclean distclean update-po $(LANGUAGES) + +all: $(MOFILES) $(MOCONVERTED) $(MSGFMT_DESKTOP) + +originals: $(MOFILES) + +converted: $(MOCONVERTED) .po.mo: $(MSGFMTCMD) -o $@ $< @@ -36,8 +43,6 @@ MSGMERGE = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes msgmerge -c "if error == 0 | q | else | num 2 | cq | endif" $< touch $@ -all: $(MOFILES) $(MOCONVERTED) $(MSGFMT_DESKTOP) - check: $(CHECKFILES) # installing for real @@ -84,12 +89,10 @@ tryoutinstall: $(MOFILES) $(MOCONVERTED) fi; \ done -converted: $(MOCONVERTED) - # nl.po was added later, if it does not exist use a file with just a # in it # (an empty file doesn't work with old msgfmt). nl.po: - @( echo \# > nl.po ) + @( echo \# >> nl.po ) # Norwegian/Bokmal: "nb" is an alias for "no". # Copying the file is not efficient, but I don't know of another way to make @@ -102,75 +105,75 @@ nb.po: no.po # ja.sjis.po is outdated. ja.sjis.po: ja.po @$(MAKE) sjiscorr - rm -f ja.sjis.po - iconv -f UTF-8 -t CP932 ja.po | ./sjiscorr > ja.sjis.po + rm -f $@ + iconv -f UTF-8 -t CP932 $< | ./sjiscorr > $@ sjiscorr: sjiscorr.c $(CC) -o sjiscorr sjiscorr.c ja.euc-jp.po: ja.po - iconv -f UTF-8 -t EUC-JP ja.po | \ + iconv -f UTF-8 -t EUC-JP $< | \ $(SED) -e 's/charset=[uU][tT][fF]-8/charset=EUC-JP/' \ - -e 's/# Original translations/# Generated from ja.po, DO NOT EDIT/' \ - > ja.euc-jp.po + -e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \ + > $@ # Convert cs.po to create cs.cp1250.po. cs.cp1250.po: cs.po - rm -f cs.cp1250.po - iconv -f ISO-8859-2 -t CP1250 cs.po | \ + rm -f $@ + iconv -f ISO-8859-2 -t CP1250 $< | \ $(SED) -e 's/charset=[iI][sS][oO]-8859-2/charset=CP1250/' \ - -e 's/# Original translations/# Generated from cs.po, DO NOT EDIT/' \ - > cs.cp1250.po + -e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \ + > $@ # Convert pl.po to create pl.cp1250.po. pl.cp1250.po: pl.po - rm -f pl.cp1250.po - iconv -f ISO-8859-2 -t CP1250 pl.po | \ + rm -f $@ + iconv -f ISO-8859-2 -t CP1250 $< | \ $(SED) -e 's/charset=[iI][sS][oO]-8859-2/charset=CP1250/' \ - -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' \ - > pl.cp1250.po + -e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \ + > $@ # Convert pl.po to create pl.UTF-8.po. pl.UTF-8.po: pl.po - rm -f pl.UTF-8.po - iconv -f ISO-8859-2 -t UTF-8 pl.po | \ + rm -f $@ + iconv -f ISO-8859-2 -t UTF-8 $< | \ $(SED) -e 's/charset=[iI][sS][oO]-8859-2/charset=UTF-8/' \ - -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' \ - > pl.UTF-8.po + -e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \ + > $@ # Convert sk.po to create sk.cp1250.po. sk.cp1250.po: sk.po - rm -f sk.cp1250.po - iconv -f ISO-8859-2 -t CP1250 sk.po | \ + rm -f $@ + iconv -f ISO-8859-2 -t CP1250 $< | \ $(SED) -e 's/charset=[iI][sS][oO]-8859-2/charset=CP1250/' \ - -e 's/# Original translations/# Generated from sk.po, DO NOT EDIT/' \ - > sk.cp1250.po + -e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \ + > $@ # Convert zh_CN.UTF-8.po to create zh_CN.po. zh_CN.po: zh_CN.UTF-8.po - rm -f zh_CN.po - iconv -f UTF-8 -t GB2312 zh_CN.UTF-8.po | \ + rm -f $@ + iconv -f UTF-8 -t GB2312 $< | \ $(SED) -e 's/charset=[uU][tT][fF]-8/charset=GB2312/' \ - -e 's/# Original translations/# Generated from zh_CN.UTF-8.po, DO NOT EDIT/' \ - > zh_CN.po + -e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \ + > $@ # Convert zh_CN.UTF-8.po to create zh_CN.cp936.po. # Set 'charset' to gbk to avoid that msfmt generates a warning. # This used to convert from zh_CN.po, but that results in a conversion error. zh_CN.cp936.po: zh_CN.UTF-8.po - rm -f zh_CN.cp936.po - iconv -f UTF-8 -t CP936 zh_CN.UTF-8.po | \ + rm -f $@ + iconv -f UTF-8 -t CP936 $< | \ $(SED) -e 's/charset=[uU][tT][fF]-8/charset=GBK/' \ - -e 's/# Original translations/# Generated from zh_CN.UTF-8.po, DO NOT EDIT/' \ - > zh_CN.cp936.po + -e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \ + > $@ # Convert zh_TW.UTF-8.po to create zh_TW.po zh_TW.po: zh_TW.UTF-8.po - rm -f zh_TW.po - iconv -f UTF-8 -t BIG5 zh_TW.UTF-8.po | \ + rm -f $@ + iconv -f UTF-8 -t BIG5 $< | \ $(SED) -e 's/charset=[uU][tT][fF]-8/charset=BIG5/' \ - -e 's/# Original translations/# Generated from zh_TW.UTF-8.po, DO NOT EDIT/' \ - > zh_TW.po + -e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \ + > $@ # Convert zh_TW.UTF-8.po to create zh_TW.po with backslash characters @@ -192,8 +195,8 @@ zh_TW.po: zh_TW.UTF-8.po #zh_TW.po: zh_TW.UTF-8.po # @$(MAKE) big5corr -# rm -f zh_TW.po -# iconv -f UTF-8 -t BIG5 zh_TW.UTF-8.po | ./big5corr > zh_TW.po +# rm -f $@ +# iconv -f UTF-8 -t BIG5 $< | ./big5corr > $@ # 06.11.23, added by Restorer @@ -204,32 +207,32 @@ zh_TW.po: zh_TW.UTF-8.po # Convert ko.UTF-8.po to create ko.po. ko.po: ko.UTF-8.po - rm -f ko.po - iconv -f UTF-8 -t EUC-KR ko.UTF-8.po | \ + rm -f $@ + iconv -f UTF-8 -t EUC-KR $< | \ $(SED) -e 's/charset=[uU][tT][fF]-8/charset=EUC-KR/' \ - -e 's/# Original translations/# Generated from ko.UTF-8.po, DO NOT EDIT/' \ - > ko.po + -e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \ + > $@ # Convert ru.po to create ru.cp1251.po. ru.cp1251.po: ru.po - rm -f ru.cp1251.po - iconv -f UTF-8 -t CP1251 ru.po | \ + rm -f $@ + iconv -f UTF-8 -t CP1251 $< | \ $(SED) -e 's/charset=[uU][tT][fF]-8/charset=CP1251/' \ - -e 's/# Original translations/# Generated from ru.po, DO NOT EDIT/' \ - > ru.cp1251.po + -e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \ + > $@ # Convert uk.po to create uk.cp1251.po. uk.cp1251.po: uk.po - rm -f uk.cp1251.po - iconv -f UTF-8 -t CP1251 uk.po | \ + rm -f $@ + iconv -f UTF-8 -t CP1251 $< | \ $(SED) -e 's/charset=[uU][tT][fF]-8/charset=CP1251/' \ - -e 's/# Original translations/# Generated from uk.po, DO NOT EDIT/' \ - > uk.cp1251.po + -e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \ + > $@ prefixcheck: @if test "x" = "x$(prefix)"; then \ echo "******************************************"; \ - echo " please use make from the src directory "; \ + echo " Please use make from the src directory "; \ echo "******************************************"; \ exit 1; \ fi @@ -283,7 +286,7 @@ gvim.desktop: gvim.desktop.in $(POFILES) vim.desktop if command -v desktop-file-validate; then desktop-file-validate tmp_gvim.desktop; fi mv tmp_gvim.desktop gvim.desktop -# When updating ja.sjis.po there are a bunch of errors and a crash. +# Only original translations with default encoding should be updated. # The files that are converted to a different encoding clearly state "DO NOT EDIT". update-po: $(MOFILES:.mo=) diff --git a/src/po/README.txt b/src/po/README.txt index 5a09d1f543..50aff6a835 100644 --- a/src/po/README.txt +++ b/src/po/README.txt @@ -30,7 +30,7 @@ The distributed files are generated on Unix, but this should also be possible on MS-Windows. Download the gettext packages, for example from: http://sourceforge.net/projects/gettext - or +or https://mlocati.github.io/articles/gettext-iconv-windows.html You might have to do the commands manually. Example: @@ -53,7 +53,10 @@ CREATING A NEW PO FILE We will use "xx.po" as an example here, replace "xx" with the name of your language. -- Edit Make_all.mak to add xx to LANGUAGES and xx.mo to MOFILES. +- Edit Make_all.mak to add xx to LANGUAGES and xx.mo to MOFILES, xx.po to + POFILES and xx.ck to CHECKFILES. +- If the encoding of the translation text differs from the default UTF-8, add a + corresponding entry in MOCONVERTED, specifying the required encoding. - If you haven't done so already, run ./configure in the top vim directory (i.e. go up two directories) and then come back here afterwards. - Execute these commands: @@ -147,13 +150,13 @@ convert ja.po to EUC-JP (supposed as your system encoding): (1) Convert the file encoding: mv ja.po ja.po.orig - iconv -f utf-8 -t euc-jp ja.po.orig > ja.po + iconv -f UTF-8 -t EUC-JP ja.po.orig > ja.po (2) Rewrite charset declaration in the file: Open ja.po find this line: - "Content-Type: text/plain; charset=utf-8\n" + "Content-Type: text/plain; charset=UTF-8\n" You should change "charset" like this: - "Content-Type: text/plain; charset=euc-jp\n" + "Content-Type: text/plain; charset=EUC-JP\n" There are examples in the Makefile for the conversions already supported. diff --git a/src/po/README_mingw.txt b/src/po/README_mingw.txt index d00ba3076a..a7e3259dca 100644 --- a/src/po/README_mingw.txt +++ b/src/po/README_mingw.txt @@ -20,8 +20,10 @@ The make utility must be run from the po directory. First of all you must set the environment variable LANGUAGE to xx, where xx is the name of your language. You can do it from the command line or adding a line to your autoexec.bat file: set LANGUAGE=xx. You must also add your -language to the Make_all.mak file in the lines LANGUAGES, MOFILES, AND -POFILES. +language to the Make_all.mak file in the lines LANGUAGES, MOFILES, POFILES, +and CHECKFILES. If the encoding of the translation text differs from the +default UTF-8, add a corresponding entry in MOCONVERTED, specifying the +required encoding. If you don't have a xx.po file, you must create it with the command: diff --git a/src/po/README_mvc.txt b/src/po/README_mvc.txt index 691e6aedf4..ae9fa2b1ff 100644 --- a/src/po/README_mvc.txt +++ b/src/po/README_mvc.txt @@ -2,18 +2,19 @@ TRANSLATING VIM MESSAGES This file explains how to create and maintain po files using a number of GnuWin packages. You will need gettext, libiconv and libexpat. As of -August 2010 the versions known to work are gettext 0.14.4, libiconv 1.9.2-1 -and expat 2.0.1. gettext and libiconv can be found at: +January 2024 the versions known to work are gettext 0.14.4, libiconv 1.9.2-1 +and expat 2.5.0. Gettext and libiconv can be found at: http://gnuwin32.sourceforge.net/ expat can be found at: http://sourceforge.net/projects/expat/ +or + https://github.com/libexpat/libexpat expat will install into its own directory. You should copy libexpat.dll into the bin directory created from the gettext/libiconv packages. - Or Michele Locati kindly provides precompiled binaries gettext 0.21 and iconv 1.16 for Windows on his site: @@ -29,11 +30,13 @@ Set the environment variable LANGUAGE to the language code for the language you are translating Vim messages to. Language codes are typically two characters and you can find a list of them at: - http://www.geocities.com/click2speak/languages.html + https://www.loc.gov/standards/iso639-2/php/code_list.php + https://www.science.co.il/language/Codes.php + https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes -Another possibility is to use the GnuWin32 port of gettext. This is -recommended especially if you use already gnuwin32 tools to gunzip, bunzip, -patch etc. these files. You find the GnuWin32 version of gettext here: +Another possibility is to use the GnuWin32 port of gettext. This is +recommended especially if you use already GnuWin32 tools to gunzip, bunzip, +patch etc. these files. You find the GnuWin32 version of gettext here: http://gnuwin32.sourceforge.net/packages/gettext.htm @@ -41,13 +44,16 @@ Yet another very strait forward way is to get the sources of gettext from http://www.gnu.org/software/gettext/gettext.html -and build your own version of these tools. The documentation states that this +and build your own version of these tools. The documentation states that this should be possible with MSVC4.0, MSVC5.0, MSVC6.0 or MSVC7.0, but you can build it even successfully with MSVC8.0. The LANGUAGE environment variable can be set from the command line, by adding a line to your autoexec.bat file, or by defining a user variable from the -Advanced tab in the System control panel. +Advanced tab in the System control panel. If the LANGUAGE environment +variable has not been set in any of the above ways, the value of this variable +will be set automatically according to the language used in the OS. This +value will be valid until the "nmake.exe" program terminates. Next, edit Make_mvc.mak so that GETTEXT_PATH points the binary directory of the installation. @@ -56,10 +62,13 @@ the installation. CREATING A NEW TRANSLATION When creating a new translation you must add your language code to the -Make_all.mak file in the lines defining LANGUAGES and MOFILES. To create the -initial .po file for your language you must use the command: +Make_all.mak file in the lines defining LANGUAGES and MOFILES, POFILES and +CHECKFILES. If the encoding of the translation text differs from the default +UTF-8, add a corresponding entry in MOCONVERTED, specifying the required +encoding. +To create the initial .po file for your language you must use the command: - make -f make_mvc.mak first_time + nmake.exe -f Make_mvc.mak first_time Note: You need to be in the po directory when using this makefile. @@ -82,7 +91,7 @@ If there are new or changed messages in Vim that need translating, then the first thing to do is merge them into the existing translations. This is done with the following command: - nmake -f Make_mvc.mak xx.po + nmake.exe -f Make_mvc.mak xx where xx is the language code for the language needing translations. The original .po file is copied to xx.po.orig. @@ -102,23 +111,30 @@ CHECKING THE TRANSLATION Check the translation with the following command: - nmake -f make_mvc.mak xx.mo + nmake.exe -f Make_mvc.mak xx.ck |