blob: fa6a1ba590968bc0dda9fc467bc2212c53024f02 [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
RestorerZ76ba7242024-01-22 20:28:12 +010041# Correct the following line for the where executeable file vim is
42# installed. Please do not put the path in quotes.
43VIM = ..\vim.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +000044
Ken Takata075ad702023-11-25 15:51:00 +010045# Correct the following line for the directory where gettext et al is
46# installed. Please do not put the path in quotes.
RestorerZe2146922023-11-23 20:58:32 +010047GETTEXT_PATH = D:\Programs\GetText\bin
Bram Moolenaar071d4272004-06-13 20:20:40 +000048
RestorerZe498caf2024-03-12 22:11:36 +010049# 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)"]
54MSGFMT = "$(GETTEXT_PATH)\msgfmt.exe" -v --no-convert
55!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +010056MSGFMT = "$(GETTEXT_PATH)\msgfmt.exe" -v
RestorerZe498caf2024-03-12 22:11:36 +010057!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +010058XGETTEXT = "$(GETTEXT_PATH)\xgettext.exe"
59MSGMERGE = "$(GETTEXT_PATH)\msgmerge.exe"
Bram Moolenaar071d4272004-06-13 20:20:40 +000060
RestorerZe2146922023-11-23 20:58:32 +010061# In case some package like GnuWin32, UnixUtils, gettext
62# or something similar is installed on the system.
63# If the "iconv" program is installed on the system, but it is not registered
64# in the %PATH% environment variable, then specify the full path to this file.
65!IF EXIST ("iconv.exe")
RestorerZe498caf2024-03-12 22:11:36 +010066ICONV = iconv.exe
RestorerZe2146922023-11-23 20:58:32 +010067!ELSEIF EXIST ("$(GETTEXT_PATH)\iconv.exe")
RestorerZe498caf2024-03-12 22:11:36 +010068ICONV = "$(GETTEXT_PATH)\iconv.exe"
RestorerZe2146922023-11-23 20:58:32 +010069!ENDIF
70
71# In case some package like GnuWin32, UnixUtils
72# or something similar is installed on the system.
73# If the "touch" program is installed on the system, but it is not registered
74# in the %PATH% environment variable, then specify the full path to this file.
75!IF EXIST ("touch.exe")
Ken Takata075ad702023-11-25 15:51:00 +010076TOUCH_TARGET = touch.exe $@
RestorerZe2146922023-11-23 20:58:32 +010077!ELSE
Ken Takata075ad702023-11-25 15:51:00 +010078TOUCH_TARGET = @if exist $@ ( copy /b $@+,, ) else ( type nul >$@ )
RestorerZe2146922023-11-23 20:58:32 +010079!ENDIF
80
81MV = move /y
82CP = copy /y
83RM = del /q
Bram Moolenaar071d4272004-06-13 20:20:40 +000084MKD = mkdir
85LS = dir
RestorerZ76ba7242024-01-22 20:28:12 +010086PS = PowerShell.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +000087
88LSFLAGS = /b /on /l /s
RestorerZ76ba7242024-01-22 20:28:12 +010089PSFLAGS = -NoLogo -NoProfile -Command
Bram Moolenaar071d4272004-06-13 20:20:40 +000090
91INSTALLDIR = $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES
92
93.SUFFIXES:
RestorerZe2146922023-11-23 20:58:32 +010094.SUFFIXES: .po .mo .pot .ck
95
96all: $(MOFILES) $(MOCONVERTED)
97
RestorerZ76ba7242024-01-22 20:28:12 +010098originals : $(MOFILES)
99
100converted: $(MOCONVERTED)
101
RestorerZe2146922023-11-23 20:58:32 +0100102.po.ck:
RestorerZ76ba7242024-01-22 20:28:12 +0100103 "$(VIM)" -u NONE --noplugins -e -s -X --cmd "set enc=utf-8" -S check.vim \
Ken Takata075ad702023-11-25 15:51:00 +0100104 -c "if error == 0 | q | else | num 2 | cq | endif" $<
105 $(TOUCH_TARGET)
RestorerZe2146922023-11-23 20:58:32 +0100106
107check: $(CHECKFILES)
108
109checkclean:
110 $(RM) *.ck
111
RestorerZe2146922023-11-23 20:58:32 +0100112nl.po:
RestorerZ76ba7242024-01-22 20:28:12 +0100113 @( echo ^# >> nl.po )
RestorerZe2146922023-11-23 20:58:32 +0100114
115# Norwegian/Bokmal: "nb" is an alias for "no".
116nb.po: no.po
117 $(CP) no.po nb.po
118
119# Convert ja.po to create ja.sjis.po.
120ja.sjis.po: ja.po
121 @$(MAKE) -nologo -f Make_mvc.mak sjiscorr
122 -$(RM) $@
123!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
124 "$(GETTEXT_PATH)\msgconv.exe" -t CP932 $? | .\sjiscorr.exe > $@
125!ELSEIF DEFINED (ICONV)
126 $(ICONV) -f UTF-8 -t CP932 $? | .\sjiscorr.exe > $@
127!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100128 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100129 [System.IO.File]::ReadAllText(\"$?\", \
130 [System.Text.Encoding]::GetEncoding(65001)), \
131 [System.Text.Encoding]::GetEncoding(932))
132 type $@ | .\sjiscorr.exe > tmp.$@
133 @$(MV) tmp.$@ $@
134!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100135 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100136 [System.Text.Encoding]::GetEncoding(932)) \
137 -replace \"`r`n\", \"`n\"; \
138 [System.IO.File]::WriteAllText(\"$@\", $$out, \
139 [System.Text.Encoding]::GetEncoding(932))
140
141sjiscorr: sjiscorr.c
142 $(CC) sjiscorr.c
143
RestorerZe498caf2024-03-12 22:11:36 +0100144# Convert ja.po to create ja.euc-jp.po.
RestorerZe2146922023-11-23 20:58:32 +0100145ja.euc-jp.po: ja.po
146 -$(RM) $@
147!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
148 "$(GETTEXT_PATH)\msgconv.exe" -t EUC-JP -o $@ $?
149!ELSE
150! IF DEFINED (ICONV)
151 $(ICONV) -f UTF-8 -t EUC-JP $? > $@
152! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100153 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100154 [System.IO.File]::ReadAllText(\"$?\", \
155 [System.Text.Encoding]::GetEncoding(65001)), \
156 [System.Text.Encoding]::GetEncoding(20932))
157! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100158 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100159 [System.Text.Encoding]::GetEncoding(20932)) -replace \
160 'charset=utf-8', 'charset=EUC-JP'; \
161 [System.IO.File]::WriteAllText(\"$@\", $$out, \
162 [System.Text.Encoding]::GetEncoding(20932))
163!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100164 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100165 [System.Text.Encoding]::GetEncoding(20932)) -replace \
166 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100167 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100168 [System.IO.File]::WriteAllText(\"$@\", $$out, \
169 [System.Text.Encoding]::GetEncoding(20932))
170
171# Convert cs.po to create cs.cp1250.po.
172cs.cp1250.po: cs.po
173 -$(RM) $@
174!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
175 "$(GETTEXT_PATH)\msgconv.exe" -t CP1250 -o $@ $?
176!ELSE
177! IF DEFINED (ICONV)
178 $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@
179! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100180 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100181 [System.IO.File]::ReadAllText(\"$?\", \
182 [System.Text.Encoding]::GetEncoding(28592)), \
183 [System.Text.Encoding]::GetEncoding(1250))
184! ENDIF
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 'charset=iso-8859-2', 'charset=CP1250'; \
188 [System.IO.File]::WriteAllText(\"$@\", $$out, \
189 [System.Text.Encoding]::GetEncoding(1250))
190!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100191 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100192 [System.Text.Encoding]::GetEncoding(1250)) -replace \
193 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100194 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100195 [System.IO.File]::WriteAllText(\"$@\", $$out, \
196 [System.Text.Encoding]::GetEncoding(1250))
197
198# Convert pl.po to create pl.cp1250.po.
199pl.cp1250.po: pl.po
200 -$(RM) $@
201!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
202 "$(GETTEXT_PATH)\msgconv.exe" -t CP1250 -o $@ $?
203!ELSE
204! IF DEFINED (ICONV)
205 $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@
206! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100207 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100208 [System.IO.File]::ReadAllText(\"$?\", \
209 [System.Text.Encoding]::GetEncoding(28592)), \
210 [System.Text.Encoding]::GetEncoding(1250))
211! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100212 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100213 [System.Text.Encoding]::GetEncoding(1250)) -replace \
214 'charset=iso-8859-2', 'charset=CP1250'; \
215 [System.IO.File]::WriteAllText(\"$@\", $$out, \
216 [System.Text.Encoding]::GetEncoding(1250))
217!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100218 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100219 [System.Text.Encoding]::GetEncoding(1250)) -replace \
220 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100221 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100222 [System.IO.File]::WriteAllText(\"$@\", $$out, \
223 [System.Text.Encoding]::GetEncoding(1250))
224
225# Convert pl.po to create pl.UTF-8.po.
226pl.UTF-8.po: pl.po
227 -$(RM) $@
228!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
229 "$(GETTEXT_PATH)\msgconv.exe" -t UTF-8 -o $@ $?
230!ELSE
231! IF DEFINED (ICONV)
232 $(ICONV) -f ISO-8859-2 -t UTF-8 $? > $@
233! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100234 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100235 [System.IO.File]::ReadAllText(\"$?\", \
236 [System.Text.Encoding]::GetEncoding(28592)))
237! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100238 $(PS) $(PSFLAGS) (Get-Content -Raw -Encoding UTF8 $@ \
RestorerZe2146922023-11-23 20:58:32 +0100239 ^| % {$$_-replace 'charset=iso-8859-2', 'charset=UTF-8'}) \
240 ^| 1>nul New-Item -Force -Path . -ItemType file -Name $@
241!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100242 $(PS) $(PSFLAGS) (Get-Content -Raw -Encoding UTF8 $@ \
RestorerZe2146922023-11-23 20:58:32 +0100243 ^| % {$$_-replace '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100244 '# Generated from $?, DO NOT EDIT'}) \
RestorerZe2146922023-11-23 20:58:32 +0100245 ^| 1>nul New-Item -Force -Path . -ItemType file -Name $@
246
247# Convert sk.po to create sk.cp1250.po.
248sk.cp1250.po: sk.po
249 -$(RM) $@
250!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
251 "$(GETTEXT_PATH)\msgconv.exe" -t CP1250 -o $@ $?
252!ELSE
253! IF DEFINED (ICONV)
254 $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@
255! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100256 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100257 [System.IO.File]::ReadAllText(\"$?\", \
258 [System.Text.Encoding]::GetEncoding(28592)), \
259 [System.Text.Encoding]::GetEncoding(1250))
260! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100261 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100262 [System.Text.Encoding]::GetEncoding(1250)) -replace \
263 'charset=iso-8859-2', 'charset=CP1250'; \
264 [System.IO.File]::WriteAllText(\"$@\", $$out, \
265 [System.Text.Encoding]::GetEncoding(1250))
266!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100267 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100268 [System.Text.Encoding]::GetEncoding(1250)) -replace \
269 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100270 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100271 [System.IO.File]::WriteAllText(\"$@\", $$out, \
272 [System.Text.Encoding]::GetEncoding(1250))
273
274# Convert zh_CN.UTF-8.po to create zh_CN.po.
275zh_CN.po: zh_CN.UTF-8.po
276 -$(RM) $@
277!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
278 "$(GETTEXT_PATH)\msgconv.exe" -t GB2312 -o $@ $?
279!ELSE
280! IF DEFINED (ICONV)
281 $(ICONV) -f UTF-8 -t GB2312 $? > $@
282! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100283 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100284 [System.IO.File]::ReadAllText(\"$?\", \
285 [System.Text.Encoding]::GetEncoding(65001)), \
286 [System.Text.Encoding]::GetEncoding(936))
287
288! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100289 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100290 [System.Text.Encoding]::GetEncoding(936)) -replace \
291 'charset=UTF-8', 'charset=GB2312'; \
292 [System.IO.File]::WriteAllText(\"$@\", $$out, \
293 [System.Text.Encoding]::GetEncoding(936))
294!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100295 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100296 [System.Text.Encoding]::GetEncoding(936)) -replace \
297 '# 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(936))
301
302# Convert zh_CN.UTF-8.po to create zh_CN.cp936.po.
303# Set 'charset' to gbk to avoid that msfmt generates a warning.
304# This used to convert from zh_CN.po, but that results in a conversion error.
305zh_CN.cp936.po: zh_CN.UTF-8.po
306 -$(RM) $@
307!IF DEFINED (ICONV)
308 $(ICONV) -f UTF-8 -t CP936 $? > $@
309!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100310 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100311 [System.IO.File]::ReadAllText(\"$?\", \
312 [System.Text.Encoding]::GetEncoding(65001)), \
313 [System.Text.Encoding]::GetEncoding(20936))
314
315!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100316 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100317 [System.Text.Encoding]::GetEncoding(20936)) \
318 -replace 'charset=UTF-8', 'charset=GBK'\
319 -replace '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100320 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100321 [System.IO.File]::WriteAllText(\"$@\", $$out, \
322 [System.Text.Encoding]::GetEncoding(20936))
323
RestorerZe498caf2024-03-12 22:11:36 +0100324# Convert zh_TW.UTF-8.po to create zh_TW.po.
RestorerZe2146922023-11-23 20:58:32 +0100325zh_TW.po: zh_TW.UTF-8.po
326 -$(RM) $@
327!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
328 "$(GETTEXT_PATH)\msgconv.exe" -t BIG5 -o $@ $?
329!ELSE
330! IF DEFINED (ICONV)
331 $(ICONV) -f UTF-8 -t BIG5 $? > $@
332! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100333 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100334 [System.IO.File]::ReadAllText(\"$?\", \
335 [System.Text.Encoding]::GetEncoding(65001)), \
336 [System.Text.Encoding]::GetEncoding(950))
337
338! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100339 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100340 [System.Text.Encoding]::GetEncoding(950)) -replace \
341 'charset=UTF-8', 'charset=BIG5'; \
342 [System.IO.File]::WriteAllText(\"$@\", $$out, \
343 [System.Text.Encoding]::GetEncoding(950))
344!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100345 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100346 [System.Text.Encoding]::GetEncoding(950)) -replace \
347 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100348 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100349 [System.IO.File]::WriteAllText(\"$@\", $$out, \
350 [System.Text.Encoding]::GetEncoding(950))
351
RestorerZe498caf2024-03-12 22:11:36 +0100352# Convert zh_TW.UTF-8.po to create zh_TW.po with backslash characters.
RestorerZe2146922023-11-23 20:58:32 +0100353# Requires doubling backslashes in the second byte. Don't depend on big5corr,
354# it should only be compiled when zh_TW.po is outdated.
RestorerZ76ba7242024-01-22 20:28:12 +0100355
RestorerZe2146922023-11-23 20:58:32 +0100356#
357# 06.11.23, added by Restorer:
358# For more details, see:
359# https://github.com/vim/vim/pull/3261
360# https://github.com/vim/vim/pull/3476
361# https://github.com/vim/vim/pull/12153
362# (read all comments)
363#
364# I checked the workability on the list of backslash characters
365# specified in zh_TW.UTF-8.po. It works.
366# But it is better to have someone native speaker check it.
367#
368
369#zh_TW.po: zh_TW.UTF-8.po
370# @$(MAKE) -nologo -f Make_mvc.mak big5corr
371# -$(RM) $@
372#!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
373# "$(GETTEXT_PATH)\msgconv.exe" -t BIG5 $? | .\big5corr.exe > $@
374#!ELSEIF DEFINED (ICONV)
375# $(ICONV) -f UTF-8 -t BIG5 $? | .\big5corr.exe > $@
376#!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100377# $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100378# [System.IO.File]::ReadAllText(\"$?\", \
379# [System.Text.Encoding]::GetEncoding(65001)), \
380# [System.Text.Encoding]::GetEncoding(950))
381# type $@ | .\big5corr.exe > tmp.$@
382# @$(MV) tmp.$@ $@
383#!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100384# $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100385# [System.Text.Encoding]::GetEncoding(950)) \
386# -replace \"`r`n\", \"`n\"; \
387# [System.IO.File]::WriteAllText(\"$@\", $$out, \
388# [System.Text.Encoding]::GetEncoding(950))
389
RestorerZe498caf2024-03-12 22:11:36 +0100390# See above in the zh_TW.po conversion section for backslashes.
RestorerZe2146922023-11-23 20:58:32 +0100391#big5corr: big5corr.c
392# $(CC) big5corr.c
393
394# Convert ko.UTF-8.po to create ko.po.
395ko.po: ko.UTF-8.po
396 -$(RM) $@
397!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
398 "$(GETTEXT_PATH)\msgconv.exe" -t EUC-KR -o $@ $?
399!ELSE
400! IF DEFINED (ICONV)
401 $(ICONV) -f UTF-8 -t EUC-KR $? > $@
402! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100403 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100404 [System.IO.File]::ReadAllText(\"$?\", \
405 [System.Text.Encoding]::GetEncoding(65001)), \
406 [System.Text.Encoding]::GetEncoding(51949))
407
408! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100409 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100410 [System.Text.Encoding]::GetEncoding(51949)) -replace \
411 'charset=UTF-8', 'charset=EUC-KR'; \
412 [System.IO.File]::WriteAllText(\"$@\", $$out, \
413 [System.Text.Encoding]::GetEncoding(51949))
414!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100415 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100416 [System.Text.Encoding]::GetEncoding(51949)) -replace \
417 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100418 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100419 [System.IO.File]::WriteAllText(\"$@\", $$out, \
420 [System.Text.Encoding]::GetEncoding(51949))
421
422# Convert ru.po to create ru.cp1251.po.
423ru.cp1251.po: ru.po
424 -$(RM) $@
425!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
426 "$(GETTEXT_PATH)\msgconv.exe" -t CP1251 -o $@ $?
427!ELSE
428! IF DEFINED (ICONV)
429 $(ICONV) -f UTF-8 -t CP1251 $? > $@
430! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100431 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100432 [System.IO.File]::ReadAllText(\"$?\", \
433 [System.Text.Encoding]::GetEncoding(65001)), \
434 [System.Text.Encoding]::GetEncoding(1251))
435
436! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100437 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100438 [System.Text.Encoding]::GetEncoding(1251)) -replace \
439 'charset=UTF-8', 'charset=CP1251'; \
440 [System.IO.File]::WriteAllText(\"$@\", $$out, \
441 [System.Text.Encoding]::GetEncoding(1251))
442!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100443 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100444 [System.Text.Encoding]::GetEncoding(1251)) -replace \
445 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100446 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100447 [System.IO.File]::WriteAllText(\"$@\", $$out, \
448 [System.Text.Encoding]::GetEncoding(1251))
449
450# Convert uk.po to create uk.cp1251.po.
451uk.cp1251.po: uk.po
452 -$(RM) $@
453!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
454 "$(GETTEXT_PATH)\msgconv.exe" -t CP1251 -o $@ $?
455!ELSE
456! IF DEFINED (ICONV)
457 $(ICONV) -f UTF-8 -t CP1251 $? > $@
458! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100459 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100460 [System.IO.File]::ReadAllText(\"$?\", \
461 [System.Text.Encoding]::GetEncoding(65001)), \
462 [System.Text.Encoding]::GetEncoding(1251))
463
464! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100465 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100466 [System.Text.Encoding]::GetEncoding(1251)) -replace \
467 'charset=UTF-8', 'charset=CP1251'; \
468 [System.IO.File]::WriteAllText(\"$@\", $$out, \
469 [System.Text.Encoding]::GetEncoding(1251))
470!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100471 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100472 [System.Text.Encoding]::GetEncoding(1251)) -replace \
473 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100474 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100475 [System.IO.File]::WriteAllText(\"$@\", $$out, \
476 [System.Text.Encoding]::GetEncoding(1251))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000477
478.po.mo:
Bram Moolenaar01380622015-12-29 16:04:42 +0100479 set OLD_PO_FILE_INPUT=yes
Bram Moolenaar071d4272004-06-13 20:20:40 +0000480 $(MSGFMT) -o $@ $<
481
Bram Moolenaarfa573352020-09-04 13:53:00 +0200482PO_INPUTLIST = \
483 ..\*.c \
484 ..\if_perl.xs \
485 ..\GvimExt\gvimext.cpp \
486 ..\errors.h \
487 ..\globals.h \
488 ..\if_py_both.h \
489 ..\vim.h \
490 gvim.desktop.in \
491 vim.desktop.in
492
Bram Moolenaar167fb6d2023-05-23 15:27:51 +0100493files: $(PO_INPUTLIST)
Bram Moolenaarfa573352020-09-04 13:53:00 +0200494 $(LS) $(LSFLAGS) $(PO_INPUTLIST) > .\files
Bram Moolenaar071d4272004-06-13 20:20:40 +0000495
RestorerZ76ba7242024-01-22 20:28:12 +0100496first_time: files
497 "$(VIM)" -u NONE --not-a-term -S tojavascript.vim $(LANGUAGE).po \
RestorerZe2146922023-11-23 20:58:32 +0100498 $(PO_VIM_INPUTLIST)
Bram Moolenaar01380622015-12-29 16:04:42 +0100499 set OLD_PO_FILE_INPUT=yes
500 set OLD_PO_FILE_OUTPUT=yes
RestorerZe2146922023-11-23 20:58:32 +0100501 $(XGETTEXT) --default-domain=$(LANGUAGE) --add-comments $(XGETTEXT_KEYWORDS) \
502 --files-from=.\files $(PO_VIM_JSLIST)
RestorerZ76ba7242024-01-22 20:28:12 +0100503 "$(VIM)" -u NONE --not-a-term -S fixfilenames.vim $(LANGUAGE).po \
RestorerZe2146922023-11-23 20:58:32 +0100504 $(PO_VIM_INPUTLIST)
Bram Moolenaarfa573352020-09-04 13:53:00 +0200505 $(RM) *.js
Bram Moolenaar071d4272004-06-13 20:20:40 +0000506
Bram Moolenaarfa573352020-09-04 13:53:00 +0200507$(PACKAGE).pot: files
RestorerZ76ba7242024-01-22 20:28:12 +0100508 "$(VIM)" -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot \
RestorerZe2146922023-11-23 20:58:32 +0100509 $(PO_VIM_INPUTLIST)
Bram Moolenaar01380622015-12-29 16:04:42 +0100510 set OLD_PO_FILE_INPUT=yes
511 set OLD_PO_FILE_OUTPUT=yes
RestorerZe2146922023-11-23 20:58:32 +0100512 $(XGETTEXT) --default-domain=$(PACKAGE) --add-comments $(XGETTEXT_KEYWORDS) \
513 --files-from=.\files $(PO_VIM_JSLIST)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000514 $(MV) $(PACKAGE).po $(PACKAGE).pot
RestorerZ76ba7242024-01-22 20:28:12 +0100515 "$(VIM)" -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot \
RestorerZe2146922023-11-23 20:58:32 +0100516 $(PO_VIM_INPUTLIST)
Bram Moolenaarfa573352020-09-04 13:53:00 +0200517 $(RM) *.js
518
RestorerZ76ba7242024-01-22 20:28:12 +0100519# Only original translations with default encoding should be updated.
RestorerZe2146922023-11-23 20:58:32 +0100520# The files that are converted to a different encoding clearly state "DO NOT EDIT".
521update-po: $(MOFILES:.mo=)
522
RestorerZe498caf2024-03-12 22:11:36 +0100523# Don't add a dependency here, we only want to update the .po files manually.
Bram Moolenaarfa573352020-09-04 13:53:00 +0200524$(LANGUAGES):
RestorerZ76ba7242024-01-22 20:28:12 +0100525 @$(MAKE) -nologo -f Make_mvc.mak GETTEXT_PATH="$(GETTEXT_PATH)" $(PACKAGE).pot
Bram Moolenaar071d4272004-06-13 20:20:40 +0000526 $(CP) $@.po $@.po.orig
527 $(MV) $@.po $@.po.old
528 $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po
529 $(RM) $@.po.old
530
RestorerZ76ba7242024-01-22 20:28:12 +0100531install: $(LANGUAGE).mo
RestorerZe498caf2024-03-12 22:11:36 +0100532 if not exist "$(INSTALLDIR)" $(MKD) "$(INSTALLDIR)"
533 $(CP) $(LANGUAGE).mo "$(INSTALLDIR)\$(PACKAGE).mo"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000534
Bram Moolenaar01380622015-12-29 16:04:42 +0100535install-all: all
RestorerZe498caf2024-03-12 22:11:36 +0100536 for %%l in ($(LANGUAGES)) do @if not exist "$(VIMRUNTIME)\lang\%%l\LC_MESSAGES" \
537 $(MKD) "$(VIMRUNTIME)\lang\%%l\LC_MESSAGES"
RestorerZe2146922023-11-23 20:58:32 +0100538 for %%l in ($(LANGUAGES)) do @$(CP) %%l.mo \
RestorerZe498caf2024-03-12 22:11:36 +0100539 "$(VIMRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo"
Bram Moolenaar01380622015-12-29 16:04:42 +0100540
RestorerZ76ba7242024-01-22 20:28:12 +0100541cleanup-po: $(LANGUAGE).po
542 "$(VIM)" -u NONE -e -X -S cleanup.vim -c wq $(LANGUAGE).po
RestorerZe2146922023-11-23 20:58:32 +0100543
544cleanup-po-all: $(POFILES)
RestorerZ76ba7242024-01-22 20:28:12 +0100545 !"$(VIM)" -u NONE -e -X -S cleanup.vim -c wq $**
RestorerZe2146922023-11-23 20:58:32 +0100546
547clean: checkclean
Bram Moolenaar071d4272004-06-13 20:20:40 +0000548 $(RM) *.mo
549 $(RM) *.pot
RestorerZ76ba7242024-01-22 20:28:12 +0100550 $(RM) *.orig
Bram Moolenaarfa573352020-09-04 13:53:00 +0200551 $(RM) files
RestorerZe2146922023-11-23 20:58:32 +0100552 $(RM) sjiscorr.obj sjiscorr.exe
553# $(RM) big5corr.obj big5corr.exe
554
555# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0 ft=make: