blob: de0339743b685f5ab8e3c3a4c7e5e508b516de6f [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001# Makefile for the Vim message translations for MSVC
2# (based on make_ming.mak)
3#
RestorerZ76ba7242024-01-22 20:28:12 +01004# Mike Williams, <mrw@eandem.co.uk>
5# 06.01.24, Restorer, <restorer@mail2k.ru>
Bram Moolenaar071d4272004-06-13 20:20:40 +00006#
7# Please read README_mvc.txt before using this file.
8#
9
RestorerZ76ba7242024-01-22 20:28:12 +010010!IF [powershell.exe -nologo -noprofile "exit $$psversiontable.psversion.major"] == 2
RestorerZe2146922023-11-23 20:58:32 +010011!ERROR The program "PowerShell" version 3.0 or higher is required to work
12!ENDIF
13
RestorerZ76ba7242024-01-22 20:28:12 +010014!IFNDEF LANGUAGE
RestorerZe498caf2024-03-12 22:11:36 +010015! IF [powershell.exe -nologo -noprofile $$lng=(Get-UICulture).TwoLetterISOLanguageName; \
16 $$Env:LANGUAGE=$$lng;Set-Content -Path .\lng.tmp -Value "LANGUAGE=$$lng"]
RestorerZ76ba7242024-01-22 20:28:12 +010017! ENDIF
18# In order for the "install" and "cleanup-po" rule to work.
19# The others work with just setting the environment variable.
20# And to show in the message.
21! INCLUDE lng.tmp
22! IF [del /q .\lng.tmp]
23! ENDIF
24! MESSAGE
25! MESSAGE The %LANGUAGE% environment variable is not set.
26! MESSAGE This variable will be temporarily set to "$(LANGUAGE)" while "nmake.exe" is running.
27! MESSAGE See README_mvc.txt for more information on the %LANGUAGE% environment variable.
28! MESSAGE
29!ELSE
30! MESSAGE LANGUAGE is already set "$(LANGUAGE)"
31!ENDIF
32
RestorerZe498caf2024-03-12 22:11:36 +010033# Get LANGUAGES, MOFILES, MOCONVERTED and others.
RestorerZe2146922023-11-23 20:58:32 +010034!INCLUDE Make_all.mak
35
36!IFNDEF VIMRUNTIME
37VIMRUNTIME = ..\..\runtime
38!ENDIF
Bram Moolenaar071d4272004-06-13 20:20:40 +000039
40PACKAGE = vim
zeertzjq7c515282024-11-10 20:26:12 +010041# Correct the following line for the where executable file vim is
RestorerZ76ba7242024-01-22 20:28:12 +010042# installed. Please do not put the path in quotes.
RestorerZ96509102024-07-11 21:14:15 +020043!IFNDEF VIMPROG
RestorerZcd33faf2024-07-04 17:47:16 +020044VIMPROG = ..\vim.exe
RestorerZ96509102024-07-11 21:14:15 +020045!ENDIF
Bram Moolenaar071d4272004-06-13 20:20:40 +000046
Ken Takata075ad702023-11-25 15:51:00 +010047# Correct the following line for the directory where gettext et al is
48# installed. Please do not put the path in quotes.
Cthulhux2f27c652024-04-10 16:34:49 +020049!IFNDEF GETTEXT_PATH
RestorerZe2146922023-11-23 20:58:32 +010050GETTEXT_PATH = D:\Programs\GetText\bin
Cthulhux2f27c652024-04-10 16:34:49 +020051!ENDIF
Bram Moolenaar071d4272004-06-13 20:20:40 +000052
RestorerZe498caf2024-03-12 22:11:36 +010053# Starting from version 0.22, msgfmt forcibly converts text to UTF-8 regardless
54# of the value of the "charset" field.
55!IF [%comspec% /v:on /e:on /c "for /F "tokens=4 delims= " %G in \
56 ('"$(GETTEXT_PATH)\msgfmt.exe" --version^|findstr /rc:[0-9^]\.[0-9^][0-9^]') do \
57 @(set "v=%G" && if !v:~2^,2! GEQ 22 exit /b 1)"]
58MSGFMT = "$(GETTEXT_PATH)\msgfmt.exe" -v --no-convert
59!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +010060MSGFMT = "$(GETTEXT_PATH)\msgfmt.exe" -v
RestorerZe498caf2024-03-12 22:11:36 +010061!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +010062XGETTEXT = "$(GETTEXT_PATH)\xgettext.exe"
63MSGMERGE = "$(GETTEXT_PATH)\msgmerge.exe"
Bram Moolenaar071d4272004-06-13 20:20:40 +000064
RestorerZe2146922023-11-23 20:58:32 +010065# In case some package like GnuWin32, UnixUtils, gettext
66# or something similar is installed on the system.
67# If the "iconv" program is installed on the system, but it is not registered
68# in the %PATH% environment variable, then specify the full path to this file.
69!IF EXIST ("iconv.exe")
RestorerZe498caf2024-03-12 22:11:36 +010070ICONV = iconv.exe
RestorerZe2146922023-11-23 20:58:32 +010071!ELSEIF EXIST ("$(GETTEXT_PATH)\iconv.exe")
RestorerZe498caf2024-03-12 22:11:36 +010072ICONV = "$(GETTEXT_PATH)\iconv.exe"
RestorerZe2146922023-11-23 20:58:32 +010073!ENDIF
74
75# In case some package like GnuWin32, UnixUtils
76# or something similar is installed on the system.
77# If the "touch" program is installed on the system, but it is not registered
78# in the %PATH% environment variable, then specify the full path to this file.
79!IF EXIST ("touch.exe")
Ken Takata075ad702023-11-25 15:51:00 +010080TOUCH_TARGET = touch.exe $@
RestorerZe2146922023-11-23 20:58:32 +010081!ELSE
Ken Takata075ad702023-11-25 15:51:00 +010082TOUCH_TARGET = @if exist $@ ( copy /b $@+,, ) else ( type nul >$@ )
RestorerZe2146922023-11-23 20:58:32 +010083!ENDIF
84
85MV = move /y
86CP = copy /y
87RM = del /q
Bram Moolenaar071d4272004-06-13 20:20:40 +000088MKD = mkdir
89LS = dir
RestorerZ76ba7242024-01-22 20:28:12 +010090PS = PowerShell.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +000091
92LSFLAGS = /b /on /l /s
RestorerZ76ba7242024-01-22 20:28:12 +010093PSFLAGS = -NoLogo -NoProfile -Command
Bram Moolenaar071d4272004-06-13 20:20:40 +000094
95INSTALLDIR = $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES
96
97.SUFFIXES:
RestorerZe2146922023-11-23 20:58:32 +010098.SUFFIXES: .po .mo .pot .ck
99
100all: $(MOFILES) $(MOCONVERTED)
101
RestorerZ76ba7242024-01-22 20:28:12 +0100102originals : $(MOFILES)
103
104converted: $(MOCONVERTED)
105
RestorerZe2146922023-11-23 20:58:32 +0100106.po.ck:
RestorerZcd33faf2024-07-04 17:47:16 +0200107 "$(VIMPROG)" -u NONE --noplugins -e -s -X --cmd "set enc=utf-8" -S check.vim \
Ken Takata075ad702023-11-25 15:51:00 +0100108 -c "if error == 0 | q | else | num 2 | cq | endif" $<
109 $(TOUCH_TARGET)
RestorerZe2146922023-11-23 20:58:32 +0100110
111check: $(CHECKFILES)
112
113checkclean:
114 $(RM) *.ck
115
RestorerZe2146922023-11-23 20:58:32 +0100116nl.po:
RestorerZ76ba7242024-01-22 20:28:12 +0100117 @( echo ^# >> nl.po )
RestorerZe2146922023-11-23 20:58:32 +0100118
119# Norwegian/Bokmal: "nb" is an alias for "no".
120nb.po: no.po
121 $(CP) no.po nb.po
122
123# Convert ja.po to create ja.sjis.po.
124ja.sjis.po: ja.po
125 @$(MAKE) -nologo -f Make_mvc.mak sjiscorr
126 -$(RM) $@
Ken Takata26306872024-08-11 19:06:58 +0200127!IF DEFINED (ICONV)
RestorerZe2146922023-11-23 20:58:32 +0100128 $(ICONV) -f UTF-8 -t CP932 $? | .\sjiscorr.exe > $@
129!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100130 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100131 [System.IO.File]::ReadAllText(\"$?\", \
132 [System.Text.Encoding]::GetEncoding(65001)), \
133 [System.Text.Encoding]::GetEncoding(932))
134 type $@ | .\sjiscorr.exe > tmp.$@
135 @$(MV) tmp.$@ $@
136!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100137 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100138 [System.Text.Encoding]::GetEncoding(932)) \
139 -replace \"`r`n\", \"`n\"; \
140 [System.IO.File]::WriteAllText(\"$@\", $$out, \
141 [System.Text.Encoding]::GetEncoding(932))
142
143sjiscorr: sjiscorr.c
144 $(CC) sjiscorr.c
145
RestorerZe498caf2024-03-12 22:11:36 +0100146# Convert ja.po to create ja.euc-jp.po.
RestorerZe2146922023-11-23 20:58:32 +0100147ja.euc-jp.po: ja.po
148 -$(RM) $@
Ken Takata26306872024-08-11 19:06:58 +0200149!IF DEFINED (ICONV)
RestorerZe2146922023-11-23 20:58:32 +0100150 $(ICONV) -f UTF-8 -t EUC-JP $? > $@
Ken Takata26306872024-08-11 19:06:58 +0200151!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100152 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100153 [System.IO.File]::ReadAllText(\"$?\", \
154 [System.Text.Encoding]::GetEncoding(65001)), \
155 [System.Text.Encoding]::GetEncoding(20932))
Ken Takata26306872024-08-11 19:06:58 +0200156!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100157 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100158 [System.Text.Encoding]::GetEncoding(20932)) -replace \
159 'charset=utf-8', 'charset=EUC-JP'; \
160 [System.IO.File]::WriteAllText(\"$@\", $$out, \
161 [System.Text.Encoding]::GetEncoding(20932))
RestorerZ76ba7242024-01-22 20:28:12 +0100162 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100163 [System.Text.Encoding]::GetEncoding(20932)) -replace \
164 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100165 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100166 [System.IO.File]::WriteAllText(\"$@\", $$out, \
167 [System.Text.Encoding]::GetEncoding(20932))
168
169# Convert cs.po to create cs.cp1250.po.
170cs.cp1250.po: cs.po
171 -$(RM) $@
Ken Takata26306872024-08-11 19:06:58 +0200172!IF DEFINED (ICONV)
RestorerZe2146922023-11-23 20:58:32 +0100173 $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@
Ken Takata26306872024-08-11 19:06:58 +0200174!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100175 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100176 [System.IO.File]::ReadAllText(\"$?\", \
177 [System.Text.Encoding]::GetEncoding(28592)), \
178 [System.Text.Encoding]::GetEncoding(1250))
Ken Takata26306872024-08-11 19:06:58 +0200179!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100180 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100181 [System.Text.Encoding]::GetEncoding(1250)) -replace \
182 'charset=iso-8859-2', 'charset=CP1250'; \
183 [System.IO.File]::WriteAllText(\"$@\", $$out, \
184 [System.Text.Encoding]::GetEncoding(1250))
RestorerZ76ba7242024-01-22 20:28:12 +0100185 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100186 [System.Text.Encoding]::GetEncoding(1250)) -replace \
187 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100188 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100189 [System.IO.File]::WriteAllText(\"$@\", $$out, \
190 [System.Text.Encoding]::GetEncoding(1250))
191
192# Convert pl.po to create pl.cp1250.po.
193pl.cp1250.po: pl.po
194 -$(RM) $@
Ken Takata26306872024-08-11 19:06:58 +0200195!IF DEFINED (ICONV)
RestorerZe2146922023-11-23 20:58:32 +0100196 $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@
Ken Takata26306872024-08-11 19:06:58 +0200197!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100198 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100199 [System.IO.File]::ReadAllText(\"$?\", \
200 [System.Text.Encoding]::GetEncoding(28592)), \
201 [System.Text.Encoding]::GetEncoding(1250))
Ken Takata26306872024-08-11 19:06:58 +0200202!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100203 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100204 [System.Text.Encoding]::GetEncoding(1250)) -replace \
205 'charset=iso-8859-2', 'charset=CP1250'; \
206 [System.IO.File]::WriteAllText(\"$@\", $$out, \
207 [System.Text.Encoding]::GetEncoding(1250))
RestorerZ76ba7242024-01-22 20:28:12 +0100208 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100209 [System.Text.Encoding]::GetEncoding(1250)) -replace \
210 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100211 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100212 [System.IO.File]::WriteAllText(\"$@\", $$out, \
213 [System.Text.Encoding]::GetEncoding(1250))
214
215# Convert pl.po to create pl.UTF-8.po.
216pl.UTF-8.po: pl.po
217 -$(RM) $@
Ken Takata26306872024-08-11 19:06:58 +0200218!IF DEFINED (ICONV)
RestorerZe2146922023-11-23 20:58:32 +0100219 $(ICONV) -f ISO-8859-2 -t UTF-8 $? > $@
Ken Takata26306872024-08-11 19:06:58 +0200220!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100221 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100222 [System.IO.File]::ReadAllText(\"$?\", \
223 [System.Text.Encoding]::GetEncoding(28592)))
Ken Takata26306872024-08-11 19:06:58 +0200224!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100225 $(PS) $(PSFLAGS) (Get-Content -Raw -Encoding UTF8 $@ \
RestorerZe2146922023-11-23 20:58:32 +0100226 ^| % {$$_-replace 'charset=iso-8859-2', 'charset=UTF-8'}) \
227 ^| 1>nul New-Item -Force -Path . -ItemType file -Name $@
RestorerZ76ba7242024-01-22 20:28:12 +0100228 $(PS) $(PSFLAGS) (Get-Content -Raw -Encoding UTF8 $@ \
RestorerZe2146922023-11-23 20:58:32 +0100229 ^| % {$$_-replace '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100230 '# Generated from $?, DO NOT EDIT'}) \
RestorerZe2146922023-11-23 20:58:32 +0100231 ^| 1>nul New-Item -Force -Path . -ItemType file -Name $@
232
233# Convert sk.po to create sk.cp1250.po.
234sk.cp1250.po: sk.po
235 -$(RM) $@
Ken Takata26306872024-08-11 19:06:58 +0200236!IF DEFINED (ICONV)
RestorerZe2146922023-11-23 20:58:32 +0100237 $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@
Ken Takata26306872024-08-11 19:06:58 +0200238!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100239 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100240 [System.IO.File]::ReadAllText(\"$?\", \
241 [System.Text.Encoding]::GetEncoding(28592)), \
242 [System.Text.Encoding]::GetEncoding(1250))
Ken Takata26306872024-08-11 19:06:58 +0200243!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100244 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100245 [System.Text.Encoding]::GetEncoding(1250)) -replace \
246 'charset=iso-8859-2', 'charset=CP1250'; \
247 [System.IO.File]::WriteAllText(\"$@\", $$out, \
248 [System.Text.Encoding]::GetEncoding(1250))
RestorerZ76ba7242024-01-22 20:28:12 +0100249 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100250 [System.Text.Encoding]::GetEncoding(1250)) -replace \
251 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100252 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100253 [System.IO.File]::WriteAllText(\"$@\", $$out, \
254 [System.Text.Encoding]::GetEncoding(1250))
255
256# Convert zh_CN.UTF-8.po to create zh_CN.po.
257zh_CN.po: zh_CN.UTF-8.po
258 -$(RM) $@
Ken Takata26306872024-08-11 19:06:58 +0200259!IF DEFINED (ICONV)
RestorerZe2146922023-11-23 20:58:32 +0100260 $(ICONV) -f UTF-8 -t GB2312 $? > $@
Ken Takata26306872024-08-11 19:06:58 +0200261!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100262 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100263 [System.IO.File]::ReadAllText(\"$?\", \
264 [System.Text.Encoding]::GetEncoding(65001)), \
265 [System.Text.Encoding]::GetEncoding(936))
266
Ken Takata26306872024-08-11 19:06:58 +0200267!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100268 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100269 [System.Text.Encoding]::GetEncoding(936)) -replace \
270 'charset=UTF-8', 'charset=GB2312'; \
271 [System.IO.File]::WriteAllText(\"$@\", $$out, \
272 [System.Text.Encoding]::GetEncoding(936))
RestorerZ76ba7242024-01-22 20:28:12 +0100273 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100274 [System.Text.Encoding]::GetEncoding(936)) -replace \
275 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100276 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100277 [System.IO.File]::WriteAllText(\"$@\", $$out, \
278 [System.Text.Encoding]::GetEncoding(936))
279
280# Convert zh_CN.UTF-8.po to create zh_CN.cp936.po.
281# Set 'charset' to gbk to avoid that msfmt generates a warning.
282# This used to convert from zh_CN.po, but that results in a conversion error.
283zh_CN.cp936.po: zh_CN.UTF-8.po
284 -$(RM) $@
285!IF DEFINED (ICONV)
286 $(ICONV) -f UTF-8 -t CP936 $? > $@
287!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100288 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100289 [System.IO.File]::ReadAllText(\"$?\", \
290 [System.Text.Encoding]::GetEncoding(65001)), \
291 [System.Text.Encoding]::GetEncoding(20936))
292
293!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100294 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100295 [System.Text.Encoding]::GetEncoding(20936)) \
296 -replace 'charset=UTF-8', 'charset=GBK'\
297 -replace '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100298 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100299 [System.IO.File]::WriteAllText(\"$@\", $$out, \
300 [System.Text.Encoding]::GetEncoding(20936))
301
RestorerZe498caf2024-03-12 22:11:36 +0100302# Convert zh_TW.UTF-8.po to create zh_TW.po.
RestorerZe2146922023-11-23 20:58:32 +0100303zh_TW.po: zh_TW.UTF-8.po
304 -$(RM) $@
Ken Takata26306872024-08-11 19:06:58 +0200305!IF DEFINED (ICONV)
RestorerZe2146922023-11-23 20:58:32 +0100306 $(ICONV) -f UTF-8 -t BIG5 $? > $@
Ken Takata26306872024-08-11 19:06:58 +0200307!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100308 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100309 [System.IO.File]::ReadAllText(\"$?\", \
310 [System.Text.Encoding]::GetEncoding(65001)), \
311 [System.Text.Encoding]::GetEncoding(950))
Ken Takata26306872024-08-11 19:06:58 +0200312!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100313 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100314 [System.Text.Encoding]::GetEncoding(950)) -replace \
315 'charset=UTF-8', 'charset=BIG5'; \
316 [System.IO.File]::WriteAllText(\"$@\", $$out, \
317 [System.Text.Encoding]::GetEncoding(950))
RestorerZ76ba7242024-01-22 20:28:12 +0100318 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100319 [System.Text.Encoding]::GetEncoding(950)) -replace \
320 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100321 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100322 [System.IO.File]::WriteAllText(\"$@\", $$out, \
323 [System.Text.Encoding]::GetEncoding(950))
324
RestorerZe498caf2024-03-12 22:11:36 +0100325# Convert zh_TW.UTF-8.po to create zh_TW.po with backslash characters.
RestorerZe2146922023-11-23 20:58:32 +0100326# Requires doubling backslashes in the second byte. Don't depend on big5corr,
327# it should only be compiled when zh_TW.po is outdated.
RestorerZ76ba7242024-01-22 20:28:12 +0100328
RestorerZe2146922023-11-23 20:58:32 +0100329#
330# 06.11.23, added by Restorer:
331# For more details, see:
332# https://github.com/vim/vim/pull/3261
333# https://github.com/vim/vim/pull/3476
334# https://github.com/vim/vim/pull/12153
335# (read all comments)
336#
337# I checked the workability on the list of backslash characters
338# specified in zh_TW.UTF-8.po. It works.
339# But it is better to have someone native speaker check it.
340#
341
342#zh_TW.po: zh_TW.UTF-8.po
343# @$(MAKE) -nologo -f Make_mvc.mak big5corr
344# -$(RM) $@
Ken Takata26306872024-08-11 19:06:58 +0200345#!IF DEFINED (ICONV)
RestorerZe2146922023-11-23 20:58:32 +0100346# $(ICONV) -f UTF-8 -t BIG5 $? | .\big5corr.exe > $@
347#!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100348# $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100349# [System.IO.File]::ReadAllText(\"$?\", \
350# [System.Text.Encoding]::GetEncoding(65001)), \
351# [System.Text.Encoding]::GetEncoding(950))
352# type $@ | .\big5corr.exe > tmp.$@
353# @$(MV) tmp.$@ $@
354#!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100355# $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100356# [System.Text.Encoding]::GetEncoding(950)) \
357# -replace \"`r`n\", \"`n\"; \
358# [System.IO.File]::WriteAllText(\"$@\", $$out, \
359# [System.Text.Encoding]::GetEncoding(950))
360
RestorerZe498caf2024-03-12 22:11:36 +0100361# See above in the zh_TW.po conversion section for backslashes.
RestorerZe2146922023-11-23 20:58:32 +0100362#big5corr: big5corr.c
363# $(CC) big5corr.c
364
365# Convert ko.UTF-8.po to create ko.po.
366ko.po: ko.UTF-8.po
367 -$(RM) $@
Ken Takata26306872024-08-11 19:06:58 +0200368!IF DEFINED (ICONV)
RestorerZe2146922023-11-23 20:58:32 +0100369 $(ICONV) -f UTF-8 -t EUC-KR $? > $@
Ken Takata26306872024-08-11 19:06:58 +0200370!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100371 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100372 [System.IO.File]::ReadAllText(\"$?\", \
373 [System.Text.Encoding]::GetEncoding(65001)), \
374 [System.Text.Encoding]::GetEncoding(51949))
375
Ken Takata26306872024-08-11 19:06:58 +0200376!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100377 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100378 [System.Text.Encoding]::GetEncoding(51949)) -replace \
379 'charset=UTF-8', 'charset=EUC-KR'; \
380 [System.IO.File]::WriteAllText(\"$@\", $$out, \
381 [System.Text.Encoding]::GetEncoding(51949))
RestorerZ76ba7242024-01-22 20:28:12 +0100382 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100383 [System.Text.Encoding]::GetEncoding(51949)) -replace \
384 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100385 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100386 [System.IO.File]::WriteAllText(\"$@\", $$out, \
387 [System.Text.Encoding]::GetEncoding(51949))
388
389# Convert ru.po to create ru.cp1251.po.
390ru.cp1251.po: ru.po
391 -$(RM) $@
Ken Takata26306872024-08-11 19:06:58 +0200392!IF DEFINED (ICONV)
RestorerZe2146922023-11-23 20:58:32 +0100393 $(ICONV) -f UTF-8 -t CP1251 $? > $@
Ken Takata26306872024-08-11 19:06:58 +0200394!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100395 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100396 [System.IO.File]::ReadAllText(\"$?\", \
397 [System.Text.Encoding]::GetEncoding(65001)), \
398 [System.Text.Encoding]::GetEncoding(1251))
Ken Takata26306872024-08-11 19:06:58 +0200399!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100400 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100401 [System.Text.Encoding]::GetEncoding(1251)) -replace \
402 'charset=UTF-8', 'charset=CP1251'; \
403 [System.IO.File]::WriteAllText(\"$@\", $$out, \
404 [System.Text.Encoding]::GetEncoding(1251))
RestorerZ76ba7242024-01-22 20:28:12 +0100405 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100406 [System.Text.Encoding]::GetEncoding(1251)) -replace \
407 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100408 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100409 [System.IO.File]::WriteAllText(\"$@\", $$out, \
410 [System.Text.Encoding]::GetEncoding(1251))
411
412# Convert uk.po to create uk.cp1251.po.
413uk.cp1251.po: uk.po
414 -$(RM) $@
Ken Takata26306872024-08-11 19:06:58 +0200415!IF DEFINED (ICONV)
RestorerZe2146922023-11-23 20:58:32 +0100416 $(ICONV) -f UTF-8 -t CP1251 $? > $@
Ken Takata26306872024-08-11 19:06:58 +0200417!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100418 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100419 [System.IO.File]::ReadAllText(\"$?\", \
420 [System.Text.Encoding]::GetEncoding(65001)), \
421 [System.Text.Encoding]::GetEncoding(1251))
Ken Takata26306872024-08-11 19:06:58 +0200422!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100423 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100424 [System.Text.Encoding]::GetEncoding(1251)) -replace \
425 'charset=UTF-8', 'charset=CP1251'; \
426 [System.IO.File]::WriteAllText(\"$@\", $$out, \
427 [System.Text.Encoding]::GetEncoding(1251))
RestorerZ76ba7242024-01-22 20:28:12 +0100428 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100429 [System.Text.Encoding]::GetEncoding(1251)) -replace \
430 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100431 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100432 [System.IO.File]::WriteAllText(\"$@\", $$out, \
433 [System.Text.Encoding]::GetEncoding(1251))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000434
435.po.mo:
Bram Moolenaar01380622015-12-29 16:04:42 +0100436 set OLD_PO_FILE_INPUT=yes
Bram Moolenaar071d4272004-06-13 20:20:40 +0000437 $(MSGFMT) -o $@ $<
438
Bram Moolenaarfa573352020-09-04 13:53:00 +0200439PO_INPUTLIST = \
440 ..\*.c \
441 ..\if_perl.xs \
442 ..\GvimExt\gvimext.cpp \
443 ..\errors.h \
444 ..\globals.h \
445 ..\if_py_both.h \
446 ..\vim.h \
447 gvim.desktop.in \
448 vim.desktop.in
449
Bram Moolenaar167fb6d2023-05-23 15:27:51 +0100450files: $(PO_INPUTLIST)
Bram Moolenaarfa573352020-09-04 13:53:00 +0200451 $(LS) $(LSFLAGS) $(PO_INPUTLIST) > .\files
Bram Moolenaar071d4272004-06-13 20:20:40 +0000452
RestorerZ76ba7242024-01-22 20:28:12 +0100453first_time: files
RestorerZcd33faf2024-07-04 17:47:16 +0200454 "$(VIMPROG)" -u NONE --not-a-term -S tojavascript.vim $(LANGUAGE).po \
RestorerZe2146922023-11-23 20:58:32 +0100455 $(PO_VIM_INPUTLIST)
Ken Takata26306872024-08-11 19:06:58 +0200456 @ copy /b .\files+.\vim_to_js .\allfiles
Bram Moolenaar01380622015-12-29 16:04:42 +0100457 set OLD_PO_FILE_INPUT=yes
458 set OLD_PO_FILE_OUTPUT=yes
RestorerZe2146922023-11-23 20:58:32 +0100459 $(XGETTEXT) --default-domain=$(LANGUAGE) --add-comments $(XGETTEXT_KEYWORDS) \
RestorerZ96509102024-07-11 21:14:15 +0200460 --files-from=.\allfiles
RestorerZcd33faf2024-07-04 17:47:16 +0200461 "$(VIMPROG)" -u NONE --not-a-term -S fixfilenames.vim $(LANGUAGE).po \
RestorerZe2146922023-11-23 20:58:32 +0100462 $(PO_VIM_INPUTLIST)
RestorerZ96509102024-07-11 21:14:15 +0200463 $(RM) *.js .\vim_to_js
Bram Moolenaar071d4272004-06-13 20:20:40 +0000464
Bram Moolenaarfa573352020-09-04 13:53:00 +0200465$(PACKAGE).pot: files
RestorerZcd33faf2024-07-04 17:47:16 +0200466 "$(VIMPROG)" -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot \
RestorerZe2146922023-11-23 20:58:32 +0100467 $(PO_VIM_INPUTLIST)
Ken Takata26306872024-08-11 19:06:58 +0200468 @ copy /b .\files+.\vim_to_js .\allfiles
Bram Moolenaar01380622015-12-29 16:04:42 +0100469 set OLD_PO_FILE_INPUT=yes
470 set OLD_PO_FILE_OUTPUT=yes
RestorerZ96509102024-07-11 21:14:15 +0200471 $(XGETTEXT) --default-domain=$(PACKAGE) --output=$(PACKAGE).pot \
472 --add-comments $(XGETTEXT_KEYWORDS) --files-from=.\allfiles
RestorerZcd33faf2024-07-04 17:47:16 +0200473 "$(VIMPROG)" -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot \
RestorerZe2146922023-11-23 20:58:32 +0100474 $(PO_VIM_INPUTLIST)
RestorerZ96509102024-07-11 21:14:15 +0200475 $(RM) *.js .\vim_to_js
Bram Moolenaarfa573352020-09-04 13:53:00 +0200476
RestorerZ76ba7242024-01-22 20:28:12 +0100477# Only original translations with default encoding should be updated.
RestorerZe2146922023-11-23 20:58:32 +0100478# The files that are converted to a different encoding clearly state "DO NOT EDIT".
479update-po: $(MOFILES:.mo=)
480
RestorerZe498caf2024-03-12 22:11:36 +0100481# Don't add a dependency here, we only want to update the .po files manually.
Bram Moolenaarfa573352020-09-04 13:53:00 +0200482$(LANGUAGES):
RestorerZ76ba7242024-01-22 20:28:12 +0100483 @$(MAKE) -nologo -f Make_mvc.mak GETTEXT_PATH="$(GETTEXT_PATH)" $(PACKAGE).pot
Bram Moolenaar071d4272004-06-13 20:20:40 +0000484 $(CP) $@.po $@.po.orig
485 $(MV) $@.po $@.po.old
486 $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po
487 $(RM) $@.po.old
488
RestorerZ76ba7242024-01-22 20:28:12 +0100489install: $(LANGUAGE).mo
RestorerZe498caf2024-03-12 22:11:36 +0100490 if not exist "$(INSTALLDIR)" $(MKD) "$(INSTALLDIR)"
491 $(CP) $(LANGUAGE).mo "$(INSTALLDIR)\$(PACKAGE).mo"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000492
Bram Moolenaar01380622015-12-29 16:04:42 +0100493install-all: all
RestorerZe498caf2024-03-12 22:11:36 +0100494 for %%l in ($(LANGUAGES)) do @if not exist "$(VIMRUNTIME)\lang\%%l\LC_MESSAGES" \
495 $(MKD) "$(VIMRUNTIME)\lang\%%l\LC_MESSAGES"
RestorerZe2146922023-11-23 20:58:32 +0100496 for %%l in ($(LANGUAGES)) do @$(CP) %%l.mo \
RestorerZe498caf2024-03-12 22:11:36 +0100497 "$(VIMRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo"
Bram Moolenaar01380622015-12-29 16:04:42 +0100498
RestorerZ76ba7242024-01-22 20:28:12 +0100499cleanup-po: $(LANGUAGE).po
RestorerZcd33faf2024-07-04 17:47:16 +0200500 "$(VIMPROG)" -u NONE -e -X -S cleanup.vim -c wq $(LANGUAGE).po
RestorerZe2146922023-11-23 20:58:32 +0100501
502cleanup-po-all: $(POFILES)
RestorerZcd33faf2024-07-04 17:47:16 +0200503 !"$(VIMPROG)" -u NONE -e -X -S cleanup.vim -c wq $**
RestorerZe2146922023-11-23 20:58:32 +0100504
RestorerZ96509102024-07-11 21:14:15 +0200505#######
506# For translations of plug-ins
507#######
508
509# Preparing the POT file of the plug-in package
510POT_PLUGPACKAGE_PATH = $(MAKEDIR)
511$(PLUGPACKAGE).pot : $(PO_PLUG_INPUTLIST)
512 "$(VIMPROG)" -u NONE --not-a-term -S tojavascript.vim \
513 $(PLUGPACKAGE).pot $**
514 $(XGETTEXT) --from-code=UTF-8 --default-domain=$(PLUGPACKAGE) \
515 --package-name=$(PLUGPACKAGE) \
516 --output-dir="$(POT_PLUGPACKAGE_PATH)" \
517 --output=$(PLUGPACKAGE).pot --files-from=.\vim_to_js
518 "$(VIMPROG)" -u NONE --not-a-term -S fixfilenames.vim \
519 "$(POT_PLUGPACKAGE_PATH)\$(PLUGPACKAGE).pot" $**
520 $(RM) *.js .\vim_to_js
521
522# Converting the PO file of the plug-in package to the binary format of the MO file
523MO_PLUGPACKAGE_PATH = $(MAKEDIR)
524$(PLUGPACKAGE).mo : $(PO_PLUGPACKAGE)
525 $(MSGFMT) -o $(MO_PLUGPACKAGE_PATH)\$@ $?
526
527
RestorerZe2146922023-11-23 20:58:32 +0100528clean: checkclean
Bram Moolenaar071d4272004-06-13 20:20:40 +0000529 $(RM) *.mo
530 $(RM) *.pot
RestorerZ76ba7242024-01-22 20:28:12 +0100531 $(RM) *.orig
RestorerZ96509102024-07-11 21:14:15 +0200532 $(RM) files allfiles
RestorerZe2146922023-11-23 20:58:32 +0100533 $(RM) sjiscorr.obj sjiscorr.exe
534# $(RM) big5corr.obj big5corr.exe
535
536# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0 ft=make: