blob: 174908ae549b865d487eaf344aaad1b1f5cf4faa [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.
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) $@
127!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
128 "$(GETTEXT_PATH)\msgconv.exe" -t CP932 $? | .\sjiscorr.exe > $@
129!ELSEIF DEFINED (ICONV)
130 $(ICONV) -f UTF-8 -t CP932 $? | .\sjiscorr.exe > $@
131!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100132 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100133 [System.IO.File]::ReadAllText(\"$?\", \
134 [System.Text.Encoding]::GetEncoding(65001)), \
135 [System.Text.Encoding]::GetEncoding(932))
136 type $@ | .\sjiscorr.exe > tmp.$@
137 @$(MV) tmp.$@ $@
138!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100139 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100140 [System.Text.Encoding]::GetEncoding(932)) \
141 -replace \"`r`n\", \"`n\"; \
142 [System.IO.File]::WriteAllText(\"$@\", $$out, \
143 [System.Text.Encoding]::GetEncoding(932))
144
145sjiscorr: sjiscorr.c
146 $(CC) sjiscorr.c
147
RestorerZe498caf2024-03-12 22:11:36 +0100148# Convert ja.po to create ja.euc-jp.po.
RestorerZe2146922023-11-23 20:58:32 +0100149ja.euc-jp.po: ja.po
150 -$(RM) $@
151!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
152 "$(GETTEXT_PATH)\msgconv.exe" -t EUC-JP -o $@ $?
153!ELSE
154! IF DEFINED (ICONV)
155 $(ICONV) -f UTF-8 -t EUC-JP $? > $@
156! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100157 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100158 [System.IO.File]::ReadAllText(\"$?\", \
159 [System.Text.Encoding]::GetEncoding(65001)), \
160 [System.Text.Encoding]::GetEncoding(20932))
161! ENDIF
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 'charset=utf-8', 'charset=EUC-JP'; \
165 [System.IO.File]::WriteAllText(\"$@\", $$out, \
166 [System.Text.Encoding]::GetEncoding(20932))
167!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100168 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100169 [System.Text.Encoding]::GetEncoding(20932)) -replace \
170 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100171 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100172 [System.IO.File]::WriteAllText(\"$@\", $$out, \
173 [System.Text.Encoding]::GetEncoding(20932))
174
175# Convert cs.po to create cs.cp1250.po.
176cs.cp1250.po: cs.po
177 -$(RM) $@
178!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
179 "$(GETTEXT_PATH)\msgconv.exe" -t CP1250 -o $@ $?
180!ELSE
181! IF DEFINED (ICONV)
182 $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@
183! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100184 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100185 [System.IO.File]::ReadAllText(\"$?\", \
186 [System.Text.Encoding]::GetEncoding(28592)), \
187 [System.Text.Encoding]::GetEncoding(1250))
188! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100189 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100190 [System.Text.Encoding]::GetEncoding(1250)) -replace \
191 'charset=iso-8859-2', 'charset=CP1250'; \
192 [System.IO.File]::WriteAllText(\"$@\", $$out, \
193 [System.Text.Encoding]::GetEncoding(1250))
194!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100195 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100196 [System.Text.Encoding]::GetEncoding(1250)) -replace \
197 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100198 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100199 [System.IO.File]::WriteAllText(\"$@\", $$out, \
200 [System.Text.Encoding]::GetEncoding(1250))
201
202# Convert pl.po to create pl.cp1250.po.
203pl.cp1250.po: pl.po
204 -$(RM) $@
205!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
206 "$(GETTEXT_PATH)\msgconv.exe" -t CP1250 -o $@ $?
207!ELSE
208! IF DEFINED (ICONV)
209 $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@
210! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100211 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100212 [System.IO.File]::ReadAllText(\"$?\", \
213 [System.Text.Encoding]::GetEncoding(28592)), \
214 [System.Text.Encoding]::GetEncoding(1250))
215! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100216 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100217 [System.Text.Encoding]::GetEncoding(1250)) -replace \
218 'charset=iso-8859-2', 'charset=CP1250'; \
219 [System.IO.File]::WriteAllText(\"$@\", $$out, \
220 [System.Text.Encoding]::GetEncoding(1250))
221!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100222 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100223 [System.Text.Encoding]::GetEncoding(1250)) -replace \
224 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100225 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100226 [System.IO.File]::WriteAllText(\"$@\", $$out, \
227 [System.Text.Encoding]::GetEncoding(1250))
228
229# Convert pl.po to create pl.UTF-8.po.
230pl.UTF-8.po: pl.po
231 -$(RM) $@
232!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
233 "$(GETTEXT_PATH)\msgconv.exe" -t UTF-8 -o $@ $?
234!ELSE
235! IF DEFINED (ICONV)
236 $(ICONV) -f ISO-8859-2 -t UTF-8 $? > $@
237! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100238 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100239 [System.IO.File]::ReadAllText(\"$?\", \
240 [System.Text.Encoding]::GetEncoding(28592)))
241! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100242 $(PS) $(PSFLAGS) (Get-Content -Raw -Encoding UTF8 $@ \
RestorerZe2146922023-11-23 20:58:32 +0100243 ^| % {$$_-replace 'charset=iso-8859-2', 'charset=UTF-8'}) \
244 ^| 1>nul New-Item -Force -Path . -ItemType file -Name $@
245!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100246 $(PS) $(PSFLAGS) (Get-Content -Raw -Encoding UTF8 $@ \
RestorerZe2146922023-11-23 20:58:32 +0100247 ^| % {$$_-replace '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100248 '# Generated from $?, DO NOT EDIT'}) \
RestorerZe2146922023-11-23 20:58:32 +0100249 ^| 1>nul New-Item -Force -Path . -ItemType file -Name $@
250
251# Convert sk.po to create sk.cp1250.po.
252sk.cp1250.po: sk.po
253 -$(RM) $@
254!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
255 "$(GETTEXT_PATH)\msgconv.exe" -t CP1250 -o $@ $?
256!ELSE
257! IF DEFINED (ICONV)
258 $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@
259! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100260 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100261 [System.IO.File]::ReadAllText(\"$?\", \
262 [System.Text.Encoding]::GetEncoding(28592)), \
263 [System.Text.Encoding]::GetEncoding(1250))
264! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100265 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100266 [System.Text.Encoding]::GetEncoding(1250)) -replace \
267 'charset=iso-8859-2', 'charset=CP1250'; \
268 [System.IO.File]::WriteAllText(\"$@\", $$out, \
269 [System.Text.Encoding]::GetEncoding(1250))
270!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100271 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100272 [System.Text.Encoding]::GetEncoding(1250)) -replace \
273 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100274 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100275 [System.IO.File]::WriteAllText(\"$@\", $$out, \
276 [System.Text.Encoding]::GetEncoding(1250))
277
278# Convert zh_CN.UTF-8.po to create zh_CN.po.
279zh_CN.po: zh_CN.UTF-8.po
280 -$(RM) $@
281!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
282 "$(GETTEXT_PATH)\msgconv.exe" -t GB2312 -o $@ $?
283!ELSE
284! IF DEFINED (ICONV)
285 $(ICONV) -f UTF-8 -t GB2312 $? > $@
286! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100287 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100288 [System.IO.File]::ReadAllText(\"$?\", \
289 [System.Text.Encoding]::GetEncoding(65001)), \
290 [System.Text.Encoding]::GetEncoding(936))
291
292! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100293 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100294 [System.Text.Encoding]::GetEncoding(936)) -replace \
295 'charset=UTF-8', 'charset=GB2312'; \
296 [System.IO.File]::WriteAllText(\"$@\", $$out, \
297 [System.Text.Encoding]::GetEncoding(936))
298!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100299 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100300 [System.Text.Encoding]::GetEncoding(936)) -replace \
301 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100302 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100303 [System.IO.File]::WriteAllText(\"$@\", $$out, \
304 [System.Text.Encoding]::GetEncoding(936))
305
306# Convert zh_CN.UTF-8.po to create zh_CN.cp936.po.
307# Set 'charset' to gbk to avoid that msfmt generates a warning.
308# This used to convert from zh_CN.po, but that results in a conversion error.
309zh_CN.cp936.po: zh_CN.UTF-8.po
310 -$(RM) $@
311!IF DEFINED (ICONV)
312 $(ICONV) -f UTF-8 -t CP936 $? > $@
313!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100314 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100315 [System.IO.File]::ReadAllText(\"$?\", \
316 [System.Text.Encoding]::GetEncoding(65001)), \
317 [System.Text.Encoding]::GetEncoding(20936))
318
319!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100320 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100321 [System.Text.Encoding]::GetEncoding(20936)) \
322 -replace 'charset=UTF-8', 'charset=GBK'\
323 -replace '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100324 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100325 [System.IO.File]::WriteAllText(\"$@\", $$out, \
326 [System.Text.Encoding]::GetEncoding(20936))
327
RestorerZe498caf2024-03-12 22:11:36 +0100328# Convert zh_TW.UTF-8.po to create zh_TW.po.
RestorerZe2146922023-11-23 20:58:32 +0100329zh_TW.po: zh_TW.UTF-8.po
330 -$(RM) $@
331!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
332 "$(GETTEXT_PATH)\msgconv.exe" -t BIG5 -o $@ $?
333!ELSE
334! IF DEFINED (ICONV)
335 $(ICONV) -f UTF-8 -t BIG5 $? > $@
336! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100337 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100338 [System.IO.File]::ReadAllText(\"$?\", \
339 [System.Text.Encoding]::GetEncoding(65001)), \
340 [System.Text.Encoding]::GetEncoding(950))
341
342! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100343 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100344 [System.Text.Encoding]::GetEncoding(950)) -replace \
345 'charset=UTF-8', 'charset=BIG5'; \
346 [System.IO.File]::WriteAllText(\"$@\", $$out, \
347 [System.Text.Encoding]::GetEncoding(950))
348!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100349 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100350 [System.Text.Encoding]::GetEncoding(950)) -replace \
351 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100352 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100353 [System.IO.File]::WriteAllText(\"$@\", $$out, \
354 [System.Text.Encoding]::GetEncoding(950))
355
RestorerZe498caf2024-03-12 22:11:36 +0100356# Convert zh_TW.UTF-8.po to create zh_TW.po with backslash characters.
RestorerZe2146922023-11-23 20:58:32 +0100357# Requires doubling backslashes in the second byte. Don't depend on big5corr,
358# it should only be compiled when zh_TW.po is outdated.
RestorerZ76ba7242024-01-22 20:28:12 +0100359
RestorerZe2146922023-11-23 20:58:32 +0100360#
361# 06.11.23, added by Restorer:
362# For more details, see:
363# https://github.com/vim/vim/pull/3261
364# https://github.com/vim/vim/pull/3476
365# https://github.com/vim/vim/pull/12153
366# (read all comments)
367#
368# I checked the workability on the list of backslash characters
369# specified in zh_TW.UTF-8.po. It works.
370# But it is better to have someone native speaker check it.
371#
372
373#zh_TW.po: zh_TW.UTF-8.po
374# @$(MAKE) -nologo -f Make_mvc.mak big5corr
375# -$(RM) $@
376#!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
377# "$(GETTEXT_PATH)\msgconv.exe" -t BIG5 $? | .\big5corr.exe > $@
378#!ELSEIF DEFINED (ICONV)
379# $(ICONV) -f UTF-8 -t BIG5 $? | .\big5corr.exe > $@
380#!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100381# $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100382# [System.IO.File]::ReadAllText(\"$?\", \
383# [System.Text.Encoding]::GetEncoding(65001)), \
384# [System.Text.Encoding]::GetEncoding(950))
385# type $@ | .\big5corr.exe > tmp.$@
386# @$(MV) tmp.$@ $@
387#!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100388# $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100389# [System.Text.Encoding]::GetEncoding(950)) \
390# -replace \"`r`n\", \"`n\"; \
391# [System.IO.File]::WriteAllText(\"$@\", $$out, \
392# [System.Text.Encoding]::GetEncoding(950))
393
RestorerZe498caf2024-03-12 22:11:36 +0100394# See above in the zh_TW.po conversion section for backslashes.
RestorerZe2146922023-11-23 20:58:32 +0100395#big5corr: big5corr.c
396# $(CC) big5corr.c
397
398# Convert ko.UTF-8.po to create ko.po.
399ko.po: ko.UTF-8.po
400 -$(RM) $@
401!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
402 "$(GETTEXT_PATH)\msgconv.exe" -t EUC-KR -o $@ $?
403!ELSE
404! IF DEFINED (ICONV)
405 $(ICONV) -f UTF-8 -t EUC-KR $? > $@
406! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100407 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100408 [System.IO.File]::ReadAllText(\"$?\", \
409 [System.Text.Encoding]::GetEncoding(65001)), \
410 [System.Text.Encoding]::GetEncoding(51949))
411
412! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100413 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100414 [System.Text.Encoding]::GetEncoding(51949)) -replace \
415 'charset=UTF-8', 'charset=EUC-KR'; \
416 [System.IO.File]::WriteAllText(\"$@\", $$out, \
417 [System.Text.Encoding]::GetEncoding(51949))
418!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100419 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100420 [System.Text.Encoding]::GetEncoding(51949)) -replace \
421 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100422 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100423 [System.IO.File]::WriteAllText(\"$@\", $$out, \
424 [System.Text.Encoding]::GetEncoding(51949))
425
426# Convert ru.po to create ru.cp1251.po.
427ru.cp1251.po: ru.po
428 -$(RM) $@
429!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
430 "$(GETTEXT_PATH)\msgconv.exe" -t CP1251 -o $@ $?
431!ELSE
432! IF DEFINED (ICONV)
433 $(ICONV) -f UTF-8 -t CP1251 $? > $@
434! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100435 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100436 [System.IO.File]::ReadAllText(\"$?\", \
437 [System.Text.Encoding]::GetEncoding(65001)), \
438 [System.Text.Encoding]::GetEncoding(1251))
439
440! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100441 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100442 [System.Text.Encoding]::GetEncoding(1251)) -replace \
443 'charset=UTF-8', 'charset=CP1251'; \
444 [System.IO.File]::WriteAllText(\"$@\", $$out, \
445 [System.Text.Encoding]::GetEncoding(1251))
446!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100447 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100448 [System.Text.Encoding]::GetEncoding(1251)) -replace \
449 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100450 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100451 [System.IO.File]::WriteAllText(\"$@\", $$out, \
452 [System.Text.Encoding]::GetEncoding(1251))
453
454# Convert uk.po to create uk.cp1251.po.
455uk.cp1251.po: uk.po
456 -$(RM) $@
457!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
458 "$(GETTEXT_PATH)\msgconv.exe" -t CP1251 -o $@ $?
459!ELSE
460! IF DEFINED (ICONV)
461 $(ICONV) -f UTF-8 -t CP1251 $? > $@
462! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100463 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100464 [System.IO.File]::ReadAllText(\"$?\", \
465 [System.Text.Encoding]::GetEncoding(65001)), \
466 [System.Text.Encoding]::GetEncoding(1251))
467
468! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100469 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100470 [System.Text.Encoding]::GetEncoding(1251)) -replace \
471 'charset=UTF-8', 'charset=CP1251'; \
472 [System.IO.File]::WriteAllText(\"$@\", $$out, \
473 [System.Text.Encoding]::GetEncoding(1251))
474!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100475 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100476 [System.Text.Encoding]::GetEncoding(1251)) -replace \
477 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100478 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100479 [System.IO.File]::WriteAllText(\"$@\", $$out, \
480 [System.Text.Encoding]::GetEncoding(1251))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000481
482.po.mo:
Bram Moolenaar01380622015-12-29 16:04:42 +0100483 set OLD_PO_FILE_INPUT=yes
Bram Moolenaar071d4272004-06-13 20:20:40 +0000484 $(MSGFMT) -o $@ $<
485
Bram Moolenaarfa573352020-09-04 13:53:00 +0200486PO_INPUTLIST = \
487 ..\*.c \
488 ..\if_perl.xs \
489 ..\GvimExt\gvimext.cpp \
490 ..\errors.h \
491 ..\globals.h \
492 ..\if_py_both.h \
493 ..\vim.h \
494 gvim.desktop.in \
495 vim.desktop.in
496
Bram Moolenaar167fb6d2023-05-23 15:27:51 +0100497files: $(PO_INPUTLIST)
Bram Moolenaarfa573352020-09-04 13:53:00 +0200498 $(LS) $(LSFLAGS) $(PO_INPUTLIST) > .\files
Bram Moolenaar071d4272004-06-13 20:20:40 +0000499
RestorerZ76ba7242024-01-22 20:28:12 +0100500first_time: files
RestorerZcd33faf2024-07-04 17:47:16 +0200501 "$(VIMPROG)" -u NONE --not-a-term -S tojavascript.vim $(LANGUAGE).po \
RestorerZe2146922023-11-23 20:58:32 +0100502 $(PO_VIM_INPUTLIST)
RestorerZ96509102024-07-11 21:14:15 +0200503 @ copy /a .\files+.\vim_to_js .\allfiles
Bram Moolenaar01380622015-12-29 16:04:42 +0100504 set OLD_PO_FILE_INPUT=yes
505 set OLD_PO_FILE_OUTPUT=yes
RestorerZe2146922023-11-23 20:58:32 +0100506 $(XGETTEXT) --default-domain=$(LANGUAGE) --add-comments $(XGETTEXT_KEYWORDS) \
RestorerZ96509102024-07-11 21:14:15 +0200507 --files-from=.\allfiles
RestorerZcd33faf2024-07-04 17:47:16 +0200508 "$(VIMPROG)" -u NONE --not-a-term -S fixfilenames.vim $(LANGUAGE).po \
RestorerZe2146922023-11-23 20:58:32 +0100509 $(PO_VIM_INPUTLIST)
RestorerZ96509102024-07-11 21:14:15 +0200510 $(RM) *.js .\vim_to_js
Bram Moolenaar071d4272004-06-13 20:20:40 +0000511
Bram Moolenaarfa573352020-09-04 13:53:00 +0200512$(PACKAGE).pot: files
RestorerZcd33faf2024-07-04 17:47:16 +0200513 "$(VIMPROG)" -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot \
RestorerZe2146922023-11-23 20:58:32 +0100514 $(PO_VIM_INPUTLIST)
RestorerZ96509102024-07-11 21:14:15 +0200515 @ copy /a .\files+.\vim_to_js .\allfiles
Bram Moolenaar01380622015-12-29 16:04:42 +0100516 set OLD_PO_FILE_INPUT=yes
517 set OLD_PO_FILE_OUTPUT=yes
RestorerZ96509102024-07-11 21:14:15 +0200518 $(XGETTEXT) --default-domain=$(PACKAGE) --output=$(PACKAGE).pot \
519 --add-comments $(XGETTEXT_KEYWORDS) --files-from=.\allfiles
RestorerZcd33faf2024-07-04 17:47:16 +0200520 "$(VIMPROG)" -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot \
RestorerZe2146922023-11-23 20:58:32 +0100521 $(PO_VIM_INPUTLIST)
RestorerZ96509102024-07-11 21:14:15 +0200522 $(RM) *.js .\vim_to_js
Bram Moolenaarfa573352020-09-04 13:53:00 +0200523
RestorerZ76ba7242024-01-22 20:28:12 +0100524# Only original translations with default encoding should be updated.
RestorerZe2146922023-11-23 20:58:32 +0100525# The files that are converted to a different encoding clearly state "DO NOT EDIT".
526update-po: $(MOFILES:.mo=)
527
RestorerZe498caf2024-03-12 22:11:36 +0100528# Don't add a dependency here, we only want to update the .po files manually.
Bram Moolenaarfa573352020-09-04 13:53:00 +0200529$(LANGUAGES):
RestorerZ76ba7242024-01-22 20:28:12 +0100530 @$(MAKE) -nologo -f Make_mvc.mak GETTEXT_PATH="$(GETTEXT_PATH)" $(PACKAGE).pot
Bram Moolenaar071d4272004-06-13 20:20:40 +0000531 $(CP) $@.po $@.po.orig
532 $(MV) $@.po $@.po.old
533 $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po
534 $(RM) $@.po.old
535
RestorerZ76ba7242024-01-22 20:28:12 +0100536install: $(LANGUAGE).mo
RestorerZe498caf2024-03-12 22:11:36 +0100537 if not exist "$(INSTALLDIR)" $(MKD) "$(INSTALLDIR)"
538 $(CP) $(LANGUAGE).mo "$(INSTALLDIR)\$(PACKAGE).mo"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000539
Bram Moolenaar01380622015-12-29 16:04:42 +0100540install-all: all
RestorerZe498caf2024-03-12 22:11:36 +0100541 for %%l in ($(LANGUAGES)) do @if not exist "$(VIMRUNTIME)\lang\%%l\LC_MESSAGES" \
542 $(MKD) "$(VIMRUNTIME)\lang\%%l\LC_MESSAGES"
RestorerZe2146922023-11-23 20:58:32 +0100543 for %%l in ($(LANGUAGES)) do @$(CP) %%l.mo \
RestorerZe498caf2024-03-12 22:11:36 +0100544 "$(VIMRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo"
Bram Moolenaar01380622015-12-29 16:04:42 +0100545
RestorerZ76ba7242024-01-22 20:28:12 +0100546cleanup-po: $(LANGUAGE).po
RestorerZcd33faf2024-07-04 17:47:16 +0200547 "$(VIMPROG)" -u NONE -e -X -S cleanup.vim -c wq $(LANGUAGE).po
RestorerZe2146922023-11-23 20:58:32 +0100548
549cleanup-po-all: $(POFILES)
RestorerZcd33faf2024-07-04 17:47:16 +0200550 !"$(VIMPROG)" -u NONE -e -X -S cleanup.vim -c wq $**
RestorerZe2146922023-11-23 20:58:32 +0100551
RestorerZ96509102024-07-11 21:14:15 +0200552#######
553# For translations of plug-ins
554#######
555
556# Preparing the POT file of the plug-in package
557POT_PLUGPACKAGE_PATH = $(MAKEDIR)
558$(PLUGPACKAGE).pot : $(PO_PLUG_INPUTLIST)
559 "$(VIMPROG)" -u NONE --not-a-term -S tojavascript.vim \
560 $(PLUGPACKAGE).pot $**
561 $(XGETTEXT) --from-code=UTF-8 --default-domain=$(PLUGPACKAGE) \
562 --package-name=$(PLUGPACKAGE) \
563 --output-dir="$(POT_PLUGPACKAGE_PATH)" \
564 --output=$(PLUGPACKAGE).pot --files-from=.\vim_to_js
565 "$(VIMPROG)" -u NONE --not-a-term -S fixfilenames.vim \
566 "$(POT_PLUGPACKAGE_PATH)\$(PLUGPACKAGE).pot" $**
567 $(RM) *.js .\vim_to_js
568
569# Converting the PO file of the plug-in package to the binary format of the MO file
570MO_PLUGPACKAGE_PATH = $(MAKEDIR)
571$(PLUGPACKAGE).mo : $(PO_PLUGPACKAGE)
572 $(MSGFMT) -o $(MO_PLUGPACKAGE_PATH)\$@ $?
573
574
RestorerZe2146922023-11-23 20:58:32 +0100575clean: checkclean
Bram Moolenaar071d4272004-06-13 20:20:40 +0000576 $(RM) *.mo
577 $(RM) *.pot
RestorerZ76ba7242024-01-22 20:28:12 +0100578 $(RM) *.orig
RestorerZ96509102024-07-11 21:14:15 +0200579 $(RM) files allfiles
RestorerZe2146922023-11-23 20:58:32 +0100580 $(RM) sjiscorr.obj sjiscorr.exe
581# $(RM) big5corr.obj big5corr.exe
582
583# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0 ft=make: