blob: d56adb0f42e301eec26b4f775bb8b538fcb1fcf6 [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.
RestorerZcd33faf2024-07-04 17:47:16 +020043VIMPROG = ..\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.
Cthulhux2f27c652024-04-10 16:34:49 +020047!IFNDEF GETTEXT_PATH
RestorerZe2146922023-11-23 20:58:32 +010048GETTEXT_PATH = D:\Programs\GetText\bin
Cthulhux2f27c652024-04-10 16:34:49 +020049!ENDIF
Bram Moolenaar071d4272004-06-13 20:20:40 +000050
RestorerZe498caf2024-03-12 22:11:36 +010051# Starting from version 0.22, msgfmt forcibly converts text to UTF-8 regardless
52# of the value of the "charset" field.
53!IF [%comspec% /v:on /e:on /c "for /F "tokens=4 delims= " %G in \
54 ('"$(GETTEXT_PATH)\msgfmt.exe" --version^|findstr /rc:[0-9^]\.[0-9^][0-9^]') do \
55 @(set "v=%G" && if !v:~2^,2! GEQ 22 exit /b 1)"]
56MSGFMT = "$(GETTEXT_PATH)\msgfmt.exe" -v --no-convert
57!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +010058MSGFMT = "$(GETTEXT_PATH)\msgfmt.exe" -v
RestorerZe498caf2024-03-12 22:11:36 +010059!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +010060XGETTEXT = "$(GETTEXT_PATH)\xgettext.exe"
61MSGMERGE = "$(GETTEXT_PATH)\msgmerge.exe"
Bram Moolenaar071d4272004-06-13 20:20:40 +000062
RestorerZe2146922023-11-23 20:58:32 +010063# In case some package like GnuWin32, UnixUtils, gettext
64# or something similar is installed on the system.
65# If the "iconv" program is installed on the system, but it is not registered
66# in the %PATH% environment variable, then specify the full path to this file.
67!IF EXIST ("iconv.exe")
RestorerZe498caf2024-03-12 22:11:36 +010068ICONV = iconv.exe
RestorerZe2146922023-11-23 20:58:32 +010069!ELSEIF EXIST ("$(GETTEXT_PATH)\iconv.exe")
RestorerZe498caf2024-03-12 22:11:36 +010070ICONV = "$(GETTEXT_PATH)\iconv.exe"
RestorerZe2146922023-11-23 20:58:32 +010071!ENDIF
72
73# In case some package like GnuWin32, UnixUtils
74# or something similar is installed on the system.
75# If the "touch" program is installed on the system, but it is not registered
76# in the %PATH% environment variable, then specify the full path to this file.
77!IF EXIST ("touch.exe")
Ken Takata075ad702023-11-25 15:51:00 +010078TOUCH_TARGET = touch.exe $@
RestorerZe2146922023-11-23 20:58:32 +010079!ELSE
Ken Takata075ad702023-11-25 15:51:00 +010080TOUCH_TARGET = @if exist $@ ( copy /b $@+,, ) else ( type nul >$@ )
RestorerZe2146922023-11-23 20:58:32 +010081!ENDIF
82
83MV = move /y
84CP = copy /y
85RM = del /q
Bram Moolenaar071d4272004-06-13 20:20:40 +000086MKD = mkdir
87LS = dir
RestorerZ76ba7242024-01-22 20:28:12 +010088PS = PowerShell.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +000089
90LSFLAGS = /b /on /l /s
RestorerZ76ba7242024-01-22 20:28:12 +010091PSFLAGS = -NoLogo -NoProfile -Command
Bram Moolenaar071d4272004-06-13 20:20:40 +000092
93INSTALLDIR = $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES
94
95.SUFFIXES:
RestorerZe2146922023-11-23 20:58:32 +010096.SUFFIXES: .po .mo .pot .ck
97
98all: $(MOFILES) $(MOCONVERTED)
99
RestorerZ76ba7242024-01-22 20:28:12 +0100100originals : $(MOFILES)
101
102converted: $(MOCONVERTED)
103
RestorerZe2146922023-11-23 20:58:32 +0100104.po.ck:
RestorerZcd33faf2024-07-04 17:47:16 +0200105 "$(VIMPROG)" -u NONE --noplugins -e -s -X --cmd "set enc=utf-8" -S check.vim \
Ken Takata075ad702023-11-25 15:51:00 +0100106 -c "if error == 0 | q | else | num 2 | cq | endif" $<
107 $(TOUCH_TARGET)
RestorerZe2146922023-11-23 20:58:32 +0100108
109check: $(CHECKFILES)
110
111checkclean:
112 $(RM) *.ck
113
RestorerZe2146922023-11-23 20:58:32 +0100114nl.po:
RestorerZ76ba7242024-01-22 20:28:12 +0100115 @( echo ^# >> nl.po )
RestorerZe2146922023-11-23 20:58:32 +0100116
117# Norwegian/Bokmal: "nb" is an alias for "no".
118nb.po: no.po
119 $(CP) no.po nb.po
120
121# Convert ja.po to create ja.sjis.po.
122ja.sjis.po: ja.po
123 @$(MAKE) -nologo -f Make_mvc.mak sjiscorr
124 -$(RM) $@
125!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
126 "$(GETTEXT_PATH)\msgconv.exe" -t CP932 $? | .\sjiscorr.exe > $@
127!ELSEIF DEFINED (ICONV)
128 $(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) $@
149!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
150 "$(GETTEXT_PATH)\msgconv.exe" -t EUC-JP -o $@ $?
151!ELSE
152! IF DEFINED (ICONV)
153 $(ICONV) -f UTF-8 -t EUC-JP $? > $@
154! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100155 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100156 [System.IO.File]::ReadAllText(\"$?\", \
157 [System.Text.Encoding]::GetEncoding(65001)), \
158 [System.Text.Encoding]::GetEncoding(20932))
159! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100160 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100161 [System.Text.Encoding]::GetEncoding(20932)) -replace \
162 'charset=utf-8', 'charset=EUC-JP'; \
163 [System.IO.File]::WriteAllText(\"$@\", $$out, \
164 [System.Text.Encoding]::GetEncoding(20932))
165!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100166 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100167 [System.Text.Encoding]::GetEncoding(20932)) -replace \
168 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100169 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100170 [System.IO.File]::WriteAllText(\"$@\", $$out, \
171 [System.Text.Encoding]::GetEncoding(20932))
172
173# Convert cs.po to create cs.cp1250.po.
174cs.cp1250.po: cs.po
175 -$(RM) $@
176!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
177 "$(GETTEXT_PATH)\msgconv.exe" -t CP1250 -o $@ $?
178!ELSE
179! IF DEFINED (ICONV)
180 $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@
181! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100182 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100183 [System.IO.File]::ReadAllText(\"$?\", \
184 [System.Text.Encoding]::GetEncoding(28592)), \
185 [System.Text.Encoding]::GetEncoding(1250))
186! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100187 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100188 [System.Text.Encoding]::GetEncoding(1250)) -replace \
189 'charset=iso-8859-2', 'charset=CP1250'; \
190 [System.IO.File]::WriteAllText(\"$@\", $$out, \
191 [System.Text.Encoding]::GetEncoding(1250))
192!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100193 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100194 [System.Text.Encoding]::GetEncoding(1250)) -replace \
195 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100196 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100197 [System.IO.File]::WriteAllText(\"$@\", $$out, \
198 [System.Text.Encoding]::GetEncoding(1250))
199
200# Convert pl.po to create pl.cp1250.po.
201pl.cp1250.po: pl.po
202 -$(RM) $@
203!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
204 "$(GETTEXT_PATH)\msgconv.exe" -t CP1250 -o $@ $?
205!ELSE
206! IF DEFINED (ICONV)
207 $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@
208! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100209 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100210 [System.IO.File]::ReadAllText(\"$?\", \
211 [System.Text.Encoding]::GetEncoding(28592)), \
212 [System.Text.Encoding]::GetEncoding(1250))
213! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100214 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100215 [System.Text.Encoding]::GetEncoding(1250)) -replace \
216 'charset=iso-8859-2', 'charset=CP1250'; \
217 [System.IO.File]::WriteAllText(\"$@\", $$out, \
218 [System.Text.Encoding]::GetEncoding(1250))
219!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100220 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100221 [System.Text.Encoding]::GetEncoding(1250)) -replace \
222 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100223 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100224 [System.IO.File]::WriteAllText(\"$@\", $$out, \
225 [System.Text.Encoding]::GetEncoding(1250))
226
227# Convert pl.po to create pl.UTF-8.po.
228pl.UTF-8.po: pl.po
229 -$(RM) $@
230!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
231 "$(GETTEXT_PATH)\msgconv.exe" -t UTF-8 -o $@ $?
232!ELSE
233! IF DEFINED (ICONV)
234 $(ICONV) -f ISO-8859-2 -t UTF-8 $? > $@
235! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100236 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100237 [System.IO.File]::ReadAllText(\"$?\", \
238 [System.Text.Encoding]::GetEncoding(28592)))
239! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100240 $(PS) $(PSFLAGS) (Get-Content -Raw -Encoding UTF8 $@ \
RestorerZe2146922023-11-23 20:58:32 +0100241 ^| % {$$_-replace 'charset=iso-8859-2', 'charset=UTF-8'}) \
242 ^| 1>nul New-Item -Force -Path . -ItemType file -Name $@
243!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100244 $(PS) $(PSFLAGS) (Get-Content -Raw -Encoding UTF8 $@ \
RestorerZe2146922023-11-23 20:58:32 +0100245 ^| % {$$_-replace '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100246 '# Generated from $?, DO NOT EDIT'}) \
RestorerZe2146922023-11-23 20:58:32 +0100247 ^| 1>nul New-Item -Force -Path . -ItemType file -Name $@
248
249# Convert sk.po to create sk.cp1250.po.
250sk.cp1250.po: sk.po
251 -$(RM) $@
252!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
253 "$(GETTEXT_PATH)\msgconv.exe" -t CP1250 -o $@ $?
254!ELSE
255! IF DEFINED (ICONV)
256 $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@
257! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100258 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100259 [System.IO.File]::ReadAllText(\"$?\", \
260 [System.Text.Encoding]::GetEncoding(28592)), \
261 [System.Text.Encoding]::GetEncoding(1250))
262! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100263 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100264 [System.Text.Encoding]::GetEncoding(1250)) -replace \
265 'charset=iso-8859-2', 'charset=CP1250'; \
266 [System.IO.File]::WriteAllText(\"$@\", $$out, \
267 [System.Text.Encoding]::GetEncoding(1250))
268!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100269 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100270 [System.Text.Encoding]::GetEncoding(1250)) -replace \
271 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100272 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100273 [System.IO.File]::WriteAllText(\"$@\", $$out, \
274 [System.Text.Encoding]::GetEncoding(1250))
275
276# Convert zh_CN.UTF-8.po to create zh_CN.po.
277zh_CN.po: zh_CN.UTF-8.po
278 -$(RM) $@
279!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
280 "$(GETTEXT_PATH)\msgconv.exe" -t GB2312 -o $@ $?
281!ELSE
282! IF DEFINED (ICONV)
283 $(ICONV) -f UTF-8 -t GB2312 $? > $@
284! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100285 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100286 [System.IO.File]::ReadAllText(\"$?\", \
287 [System.Text.Encoding]::GetEncoding(65001)), \
288 [System.Text.Encoding]::GetEncoding(936))
289
290! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100291 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100292 [System.Text.Encoding]::GetEncoding(936)) -replace \
293 'charset=UTF-8', 'charset=GB2312'; \
294 [System.IO.File]::WriteAllText(\"$@\", $$out, \
295 [System.Text.Encoding]::GetEncoding(936))
296!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100297 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100298 [System.Text.Encoding]::GetEncoding(936)) -replace \
299 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100300 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100301 [System.IO.File]::WriteAllText(\"$@\", $$out, \
302 [System.Text.Encoding]::GetEncoding(936))
303
304# Convert zh_CN.UTF-8.po to create zh_CN.cp936.po.
305# Set 'charset' to gbk to avoid that msfmt generates a warning.
306# This used to convert from zh_CN.po, but that results in a conversion error.
307zh_CN.cp936.po: zh_CN.UTF-8.po
308 -$(RM) $@
309!IF DEFINED (ICONV)
310 $(ICONV) -f UTF-8 -t CP936 $? > $@
311!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100312 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100313 [System.IO.File]::ReadAllText(\"$?\", \
314 [System.Text.Encoding]::GetEncoding(65001)), \
315 [System.Text.Encoding]::GetEncoding(20936))
316
317!ENDIF
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(20936)) \
320 -replace 'charset=UTF-8', 'charset=GBK'\
321 -replace '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100322 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100323 [System.IO.File]::WriteAllText(\"$@\", $$out, \
324 [System.Text.Encoding]::GetEncoding(20936))
325
RestorerZe498caf2024-03-12 22:11:36 +0100326# Convert zh_TW.UTF-8.po to create zh_TW.po.
RestorerZe2146922023-11-23 20:58:32 +0100327zh_TW.po: zh_TW.UTF-8.po
328 -$(RM) $@
329!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
330 "$(GETTEXT_PATH)\msgconv.exe" -t BIG5 -o $@ $?
331!ELSE
332! IF DEFINED (ICONV)
333 $(ICONV) -f UTF-8 -t BIG5 $? > $@
334! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100335 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100336 [System.IO.File]::ReadAllText(\"$?\", \
337 [System.Text.Encoding]::GetEncoding(65001)), \
338 [System.Text.Encoding]::GetEncoding(950))
339
340! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100341 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100342 [System.Text.Encoding]::GetEncoding(950)) -replace \
343 'charset=UTF-8', 'charset=BIG5'; \
344 [System.IO.File]::WriteAllText(\"$@\", $$out, \
345 [System.Text.Encoding]::GetEncoding(950))
346!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100347 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100348 [System.Text.Encoding]::GetEncoding(950)) -replace \
349 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100350 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100351 [System.IO.File]::WriteAllText(\"$@\", $$out, \
352 [System.Text.Encoding]::GetEncoding(950))
353
RestorerZe498caf2024-03-12 22:11:36 +0100354# Convert zh_TW.UTF-8.po to create zh_TW.po with backslash characters.
RestorerZe2146922023-11-23 20:58:32 +0100355# Requires doubling backslashes in the second byte. Don't depend on big5corr,
356# it should only be compiled when zh_TW.po is outdated.
RestorerZ76ba7242024-01-22 20:28:12 +0100357
RestorerZe2146922023-11-23 20:58:32 +0100358#
359# 06.11.23, added by Restorer:
360# For more details, see:
361# https://github.com/vim/vim/pull/3261
362# https://github.com/vim/vim/pull/3476
363# https://github.com/vim/vim/pull/12153
364# (read all comments)
365#
366# I checked the workability on the list of backslash characters
367# specified in zh_TW.UTF-8.po. It works.
368# But it is better to have someone native speaker check it.
369#
370
371#zh_TW.po: zh_TW.UTF-8.po
372# @$(MAKE) -nologo -f Make_mvc.mak big5corr
373# -$(RM) $@
374#!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
375# "$(GETTEXT_PATH)\msgconv.exe" -t BIG5 $? | .\big5corr.exe > $@
376#!ELSEIF DEFINED (ICONV)
377# $(ICONV) -f UTF-8 -t BIG5 $? | .\big5corr.exe > $@
378#!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100379# $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100380# [System.IO.File]::ReadAllText(\"$?\", \
381# [System.Text.Encoding]::GetEncoding(65001)), \
382# [System.Text.Encoding]::GetEncoding(950))
383# type $@ | .\big5corr.exe > tmp.$@
384# @$(MV) tmp.$@ $@
385#!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100386# $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100387# [System.Text.Encoding]::GetEncoding(950)) \
388# -replace \"`r`n\", \"`n\"; \
389# [System.IO.File]::WriteAllText(\"$@\", $$out, \
390# [System.Text.Encoding]::GetEncoding(950))
391
RestorerZe498caf2024-03-12 22:11:36 +0100392# See above in the zh_TW.po conversion section for backslashes.
RestorerZe2146922023-11-23 20:58:32 +0100393#big5corr: big5corr.c
394# $(CC) big5corr.c
395
396# Convert ko.UTF-8.po to create ko.po.
397ko.po: ko.UTF-8.po
398 -$(RM) $@
399!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
400 "$(GETTEXT_PATH)\msgconv.exe" -t EUC-KR -o $@ $?
401!ELSE
402! IF DEFINED (ICONV)
403 $(ICONV) -f UTF-8 -t EUC-KR $? > $@
404! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100405 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100406 [System.IO.File]::ReadAllText(\"$?\", \
407 [System.Text.Encoding]::GetEncoding(65001)), \
408 [System.Text.Encoding]::GetEncoding(51949))
409
410! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100411 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100412 [System.Text.Encoding]::GetEncoding(51949)) -replace \
413 'charset=UTF-8', 'charset=EUC-KR'; \
414 [System.IO.File]::WriteAllText(\"$@\", $$out, \
415 [System.Text.Encoding]::GetEncoding(51949))
416!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100417 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100418 [System.Text.Encoding]::GetEncoding(51949)) -replace \
419 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100420 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100421 [System.IO.File]::WriteAllText(\"$@\", $$out, \
422 [System.Text.Encoding]::GetEncoding(51949))
423
424# Convert ru.po to create ru.cp1251.po.
425ru.cp1251.po: ru.po
426 -$(RM) $@
427!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
428 "$(GETTEXT_PATH)\msgconv.exe" -t CP1251 -o $@ $?
429!ELSE
430! IF DEFINED (ICONV)
431 $(ICONV) -f UTF-8 -t CP1251 $? > $@
432! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100433 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100434 [System.IO.File]::ReadAllText(\"$?\", \
435 [System.Text.Encoding]::GetEncoding(65001)), \
436 [System.Text.Encoding]::GetEncoding(1251))
437
438! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100439 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100440 [System.Text.Encoding]::GetEncoding(1251)) -replace \
441 'charset=UTF-8', 'charset=CP1251'; \
442 [System.IO.File]::WriteAllText(\"$@\", $$out, \
443 [System.Text.Encoding]::GetEncoding(1251))
444!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100445 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100446 [System.Text.Encoding]::GetEncoding(1251)) -replace \
447 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100448 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100449 [System.IO.File]::WriteAllText(\"$@\", $$out, \
450 [System.Text.Encoding]::GetEncoding(1251))
451
452# Convert uk.po to create uk.cp1251.po.
453uk.cp1251.po: uk.po
454 -$(RM) $@
455!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
456 "$(GETTEXT_PATH)\msgconv.exe" -t CP1251 -o $@ $?
457!ELSE
458! IF DEFINED (ICONV)
459 $(ICONV) -f UTF-8 -t CP1251 $? > $@
460! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100461 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100462 [System.IO.File]::ReadAllText(\"$?\", \
463 [System.Text.Encoding]::GetEncoding(65001)), \
464 [System.Text.Encoding]::GetEncoding(1251))
465
466! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100467 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100468 [System.Text.Encoding]::GetEncoding(1251)) -replace \
469 'charset=UTF-8', 'charset=CP1251'; \
470 [System.IO.File]::WriteAllText(\"$@\", $$out, \
471 [System.Text.Encoding]::GetEncoding(1251))
472!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100473 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100474 [System.Text.Encoding]::GetEncoding(1251)) -replace \
475 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100476 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100477 [System.IO.File]::WriteAllText(\"$@\", $$out, \
478 [System.Text.Encoding]::GetEncoding(1251))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000479
480.po.mo:
Bram Moolenaar01380622015-12-29 16:04:42 +0100481 set OLD_PO_FILE_INPUT=yes
Bram Moolenaar071d4272004-06-13 20:20:40 +0000482 $(MSGFMT) -o $@ $<
483
Bram Moolenaarfa573352020-09-04 13:53:00 +0200484PO_INPUTLIST = \
485 ..\*.c \
486 ..\if_perl.xs \
487 ..\GvimExt\gvimext.cpp \
488 ..\errors.h \
489 ..\globals.h \
490 ..\if_py_both.h \
491 ..\vim.h \
492 gvim.desktop.in \
493 vim.desktop.in
494
Bram Moolenaar167fb6d2023-05-23 15:27:51 +0100495files: $(PO_INPUTLIST)
Bram Moolenaarfa573352020-09-04 13:53:00 +0200496 $(LS) $(LSFLAGS) $(PO_INPUTLIST) > .\files
Bram Moolenaar071d4272004-06-13 20:20:40 +0000497
RestorerZ76ba7242024-01-22 20:28:12 +0100498first_time: files
RestorerZcd33faf2024-07-04 17:47:16 +0200499 "$(VIMPROG)" -u NONE --not-a-term -S tojavascript.vim $(LANGUAGE).po \
RestorerZe2146922023-11-23 20:58:32 +0100500 $(PO_VIM_INPUTLIST)
Bram Moolenaar01380622015-12-29 16:04:42 +0100501 set OLD_PO_FILE_INPUT=yes
502 set OLD_PO_FILE_OUTPUT=yes
RestorerZe2146922023-11-23 20:58:32 +0100503 $(XGETTEXT) --default-domain=$(LANGUAGE) --add-comments $(XGETTEXT_KEYWORDS) \
504 --files-from=.\files $(PO_VIM_JSLIST)
RestorerZcd33faf2024-07-04 17:47:16 +0200505 "$(VIMPROG)" -u NONE --not-a-term -S fixfilenames.vim $(LANGUAGE).po \
RestorerZe2146922023-11-23 20:58:32 +0100506 $(PO_VIM_INPUTLIST)
Bram Moolenaarfa573352020-09-04 13:53:00 +0200507 $(RM) *.js
Bram Moolenaar071d4272004-06-13 20:20:40 +0000508
Bram Moolenaarfa573352020-09-04 13:53:00 +0200509$(PACKAGE).pot: files
RestorerZcd33faf2024-07-04 17:47:16 +0200510 "$(VIMPROG)" -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot \
RestorerZe2146922023-11-23 20:58:32 +0100511 $(PO_VIM_INPUTLIST)
Bram Moolenaar01380622015-12-29 16:04:42 +0100512 set OLD_PO_FILE_INPUT=yes
513 set OLD_PO_FILE_OUTPUT=yes
RestorerZe2146922023-11-23 20:58:32 +0100514 $(XGETTEXT) --default-domain=$(PACKAGE) --add-comments $(XGETTEXT_KEYWORDS) \
515 --files-from=.\files $(PO_VIM_JSLIST)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000516 $(MV) $(PACKAGE).po $(PACKAGE).pot
RestorerZcd33faf2024-07-04 17:47:16 +0200517 "$(VIMPROG)" -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot \
RestorerZe2146922023-11-23 20:58:32 +0100518 $(PO_VIM_INPUTLIST)
Bram Moolenaarfa573352020-09-04 13:53:00 +0200519 $(RM) *.js
520
RestorerZ76ba7242024-01-22 20:28:12 +0100521# Only original translations with default encoding should be updated.
RestorerZe2146922023-11-23 20:58:32 +0100522# The files that are converted to a different encoding clearly state "DO NOT EDIT".
523update-po: $(MOFILES:.mo=)
524
RestorerZe498caf2024-03-12 22:11:36 +0100525# Don't add a dependency here, we only want to update the .po files manually.
Bram Moolenaarfa573352020-09-04 13:53:00 +0200526$(LANGUAGES):
RestorerZ76ba7242024-01-22 20:28:12 +0100527 @$(MAKE) -nologo -f Make_mvc.mak GETTEXT_PATH="$(GETTEXT_PATH)" $(PACKAGE).pot
Bram Moolenaar071d4272004-06-13 20:20:40 +0000528 $(CP) $@.po $@.po.orig
529 $(MV) $@.po $@.po.old
530 $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po
531 $(RM) $@.po.old
532
RestorerZ76ba7242024-01-22 20:28:12 +0100533install: $(LANGUAGE).mo
RestorerZe498caf2024-03-12 22:11:36 +0100534 if not exist "$(INSTALLDIR)" $(MKD) "$(INSTALLDIR)"
535 $(CP) $(LANGUAGE).mo "$(INSTALLDIR)\$(PACKAGE).mo"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000536
Bram Moolenaar01380622015-12-29 16:04:42 +0100537install-all: all
RestorerZe498caf2024-03-12 22:11:36 +0100538 for %%l in ($(LANGUAGES)) do @if not exist "$(VIMRUNTIME)\lang\%%l\LC_MESSAGES" \
539 $(MKD) "$(VIMRUNTIME)\lang\%%l\LC_MESSAGES"
RestorerZe2146922023-11-23 20:58:32 +0100540 for %%l in ($(LANGUAGES)) do @$(CP) %%l.mo \
RestorerZe498caf2024-03-12 22:11:36 +0100541 "$(VIMRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo"
Bram Moolenaar01380622015-12-29 16:04:42 +0100542
RestorerZ76ba7242024-01-22 20:28:12 +0100543cleanup-po: $(LANGUAGE).po
RestorerZcd33faf2024-07-04 17:47:16 +0200544 "$(VIMPROG)" -u NONE -e -X -S cleanup.vim -c wq $(LANGUAGE).po
RestorerZe2146922023-11-23 20:58:32 +0100545
546cleanup-po-all: $(POFILES)
RestorerZcd33faf2024-07-04 17:47:16 +0200547 !"$(VIMPROG)" -u NONE -e -X -S cleanup.vim -c wq $**
RestorerZe2146922023-11-23 20:58:32 +0100548
549clean: checkclean
Bram Moolenaar071d4272004-06-13 20:20:40 +0000550 $(RM) *.mo
551 $(RM) *.pot
RestorerZ76ba7242024-01-22 20:28:12 +0100552 $(RM) *.orig
Bram Moolenaarfa573352020-09-04 13:53:00 +0200553 $(RM) files
RestorerZe2146922023-11-23 20:58:32 +0100554 $(RM) sjiscorr.obj sjiscorr.exe
555# $(RM) big5corr.obj big5corr.exe
556
557# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0 ft=make: