blob: 1387c338b2e2d6790048c4afc6fd91f4051f209f [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
15! IF [powershell.exe -nologo -noprofile $$lng=(Get-UICulture).TwoLetterISOLanguageName;$$Env:LANGUAGE=$$lng;Set-Content -Path .\lng.tmp -Value "LANGUAGE=$$lng"]
16#! IF [powershell.exe -nologo -noprofile -command $$Env:LANGUAGE=(Get-UICulture).TwoLetterISOLanguageName]
17! 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
Bram Moolenaar167fb6d2023-05-23 15:27:51 +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
RestorerZ76ba7242024-01-22 20:28:12 +010049MSGFMT = "$(GETTEXT_PATH)\msgfmt.exe" -v
50XGETTEXT = "$(GETTEXT_PATH)\xgettext.exe"
51MSGMERGE = "$(GETTEXT_PATH)\msgmerge.exe"
Bram Moolenaar071d4272004-06-13 20:20:40 +000052
RestorerZe2146922023-11-23 20:58:32 +010053# In case some package like GnuWin32, UnixUtils, gettext
54# or something similar is installed on the system.
55# If the "iconv" program is installed on the system, but it is not registered
56# in the %PATH% environment variable, then specify the full path to this file.
57!IF EXIST ("iconv.exe")
58ICONV = "iconv.exe"
59!ELSEIF EXIST ("$(GETTEXT_PATH)\iconv.exe")
60ICONV="$(GETTEXT_PATH)\iconv.exe"
61!ENDIF
62
63# In case some package like GnuWin32, UnixUtils
64# or something similar is installed on the system.
65# If the "touch" 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 ("touch.exe")
Ken Takata075ad702023-11-25 15:51:00 +010068TOUCH_TARGET = touch.exe $@
RestorerZe2146922023-11-23 20:58:32 +010069!ELSE
Ken Takata075ad702023-11-25 15:51:00 +010070TOUCH_TARGET = @if exist $@ ( copy /b $@+,, ) else ( type nul >$@ )
RestorerZe2146922023-11-23 20:58:32 +010071!ENDIF
72
73MV = move /y
74CP = copy /y
75RM = del /q
Bram Moolenaar071d4272004-06-13 20:20:40 +000076MKD = mkdir
77LS = dir
RestorerZ76ba7242024-01-22 20:28:12 +010078PS = PowerShell.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +000079
80LSFLAGS = /b /on /l /s
RestorerZ76ba7242024-01-22 20:28:12 +010081PSFLAGS = -NoLogo -NoProfile -Command
Bram Moolenaar071d4272004-06-13 20:20:40 +000082
83INSTALLDIR = $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES
84
85.SUFFIXES:
RestorerZe2146922023-11-23 20:58:32 +010086.SUFFIXES: .po .mo .pot .ck
87
88all: $(MOFILES) $(MOCONVERTED)
89
RestorerZ76ba7242024-01-22 20:28:12 +010090originals : $(MOFILES)
91
92converted: $(MOCONVERTED)
93
RestorerZe2146922023-11-23 20:58:32 +010094.po.ck:
RestorerZ76ba7242024-01-22 20:28:12 +010095 "$(VIM)" -u NONE --noplugins -e -s -X --cmd "set enc=utf-8" -S check.vim \
Ken Takata075ad702023-11-25 15:51:00 +010096 -c "if error == 0 | q | else | num 2 | cq | endif" $<
97 $(TOUCH_TARGET)
RestorerZe2146922023-11-23 20:58:32 +010098
99check: $(CHECKFILES)
100
101checkclean:
102 $(RM) *.ck
103
RestorerZe2146922023-11-23 20:58:32 +0100104nl.po:
RestorerZ76ba7242024-01-22 20:28:12 +0100105 @( echo ^# >> nl.po )
RestorerZe2146922023-11-23 20:58:32 +0100106
107# Norwegian/Bokmal: "nb" is an alias for "no".
108nb.po: no.po
109 $(CP) no.po nb.po
110
111# Convert ja.po to create ja.sjis.po.
112ja.sjis.po: ja.po
113 @$(MAKE) -nologo -f Make_mvc.mak sjiscorr
114 -$(RM) $@
115!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
116 "$(GETTEXT_PATH)\msgconv.exe" -t CP932 $? | .\sjiscorr.exe > $@
117!ELSEIF DEFINED (ICONV)
118 $(ICONV) -f UTF-8 -t CP932 $? | .\sjiscorr.exe > $@
119!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100120 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100121 [System.IO.File]::ReadAllText(\"$?\", \
122 [System.Text.Encoding]::GetEncoding(65001)), \
123 [System.Text.Encoding]::GetEncoding(932))
124 type $@ | .\sjiscorr.exe > tmp.$@
125 @$(MV) tmp.$@ $@
126!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100127 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100128 [System.Text.Encoding]::GetEncoding(932)) \
129 -replace \"`r`n\", \"`n\"; \
130 [System.IO.File]::WriteAllText(\"$@\", $$out, \
131 [System.Text.Encoding]::GetEncoding(932))
132
133sjiscorr: sjiscorr.c
134 $(CC) sjiscorr.c
135
136# Convert ja.po to create ja.euc-jp.po
137ja.euc-jp.po: ja.po
138 -$(RM) $@
139!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
140 "$(GETTEXT_PATH)\msgconv.exe" -t EUC-JP -o $@ $?
141!ELSE
142! IF DEFINED (ICONV)
143 $(ICONV) -f UTF-8 -t EUC-JP $? > $@
144! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100145 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100146 [System.IO.File]::ReadAllText(\"$?\", \
147 [System.Text.Encoding]::GetEncoding(65001)), \
148 [System.Text.Encoding]::GetEncoding(20932))
149! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100150 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100151 [System.Text.Encoding]::GetEncoding(20932)) -replace \
152 'charset=utf-8', 'charset=EUC-JP'; \
153 [System.IO.File]::WriteAllText(\"$@\", $$out, \
154 [System.Text.Encoding]::GetEncoding(20932))
155!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100156 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100157 [System.Text.Encoding]::GetEncoding(20932)) -replace \
158 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100159 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100160 [System.IO.File]::WriteAllText(\"$@\", $$out, \
161 [System.Text.Encoding]::GetEncoding(20932))
162
163# Convert cs.po to create cs.cp1250.po.
164cs.cp1250.po: cs.po
165 -$(RM) $@
166!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
167 "$(GETTEXT_PATH)\msgconv.exe" -t CP1250 -o $@ $?
168!ELSE
169! IF DEFINED (ICONV)
170 $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@
171! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100172 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100173 [System.IO.File]::ReadAllText(\"$?\", \
174 [System.Text.Encoding]::GetEncoding(28592)), \
175 [System.Text.Encoding]::GetEncoding(1250))
176! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100177 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100178 [System.Text.Encoding]::GetEncoding(1250)) -replace \
179 'charset=iso-8859-2', 'charset=CP1250'; \
180 [System.IO.File]::WriteAllText(\"$@\", $$out, \
181 [System.Text.Encoding]::GetEncoding(1250))
182!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100183 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100184 [System.Text.Encoding]::GetEncoding(1250)) -replace \
185 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100186 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100187 [System.IO.File]::WriteAllText(\"$@\", $$out, \
188 [System.Text.Encoding]::GetEncoding(1250))
189
190# Convert pl.po to create pl.cp1250.po.
191pl.cp1250.po: pl.po
192 -$(RM) $@
193!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
194 "$(GETTEXT_PATH)\msgconv.exe" -t CP1250 -o $@ $?
195!ELSE
196! IF DEFINED (ICONV)
197 $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@
198! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100199 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100200 [System.IO.File]::ReadAllText(\"$?\", \
201 [System.Text.Encoding]::GetEncoding(28592)), \
202 [System.Text.Encoding]::GetEncoding(1250))
203! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100204 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100205 [System.Text.Encoding]::GetEncoding(1250)) -replace \
206 'charset=iso-8859-2', 'charset=CP1250'; \
207 [System.IO.File]::WriteAllText(\"$@\", $$out, \
208 [System.Text.Encoding]::GetEncoding(1250))
209!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100210 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100211 [System.Text.Encoding]::GetEncoding(1250)) -replace \
212 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100213 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100214 [System.IO.File]::WriteAllText(\"$@\", $$out, \
215 [System.Text.Encoding]::GetEncoding(1250))
216
217# Convert pl.po to create pl.UTF-8.po.
218pl.UTF-8.po: pl.po
219 -$(RM) $@
220!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
221 "$(GETTEXT_PATH)\msgconv.exe" -t UTF-8 -o $@ $?
222!ELSE
223! IF DEFINED (ICONV)
224 $(ICONV) -f ISO-8859-2 -t UTF-8 $? > $@
225! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100226 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100227 [System.IO.File]::ReadAllText(\"$?\", \
228 [System.Text.Encoding]::GetEncoding(28592)))
229! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100230 $(PS) $(PSFLAGS) (Get-Content -Raw -Encoding UTF8 $@ \
RestorerZe2146922023-11-23 20:58:32 +0100231 ^| % {$$_-replace 'charset=iso-8859-2', 'charset=UTF-8'}) \
232 ^| 1>nul New-Item -Force -Path . -ItemType file -Name $@
233!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100234 $(PS) $(PSFLAGS) (Get-Content -Raw -Encoding UTF8 $@ \
RestorerZe2146922023-11-23 20:58:32 +0100235 ^| % {$$_-replace '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100236 '# Generated from $?, DO NOT EDIT'}) \
RestorerZe2146922023-11-23 20:58:32 +0100237 ^| 1>nul New-Item -Force -Path . -ItemType file -Name $@
238
239# Convert sk.po to create sk.cp1250.po.
240sk.cp1250.po: sk.po
241 -$(RM) $@
242!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
243 "$(GETTEXT_PATH)\msgconv.exe" -t CP1250 -o $@ $?
244!ELSE
245! IF DEFINED (ICONV)
246 $(ICONV) -f ISO-8859-2 -t CP1250 $? > $@
247! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100248 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100249 [System.IO.File]::ReadAllText(\"$?\", \
250 [System.Text.Encoding]::GetEncoding(28592)), \
251 [System.Text.Encoding]::GetEncoding(1250))
252! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100253 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100254 [System.Text.Encoding]::GetEncoding(1250)) -replace \
255 'charset=iso-8859-2', 'charset=CP1250'; \
256 [System.IO.File]::WriteAllText(\"$@\", $$out, \
257 [System.Text.Encoding]::GetEncoding(1250))
258!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100259 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100260 [System.Text.Encoding]::GetEncoding(1250)) -replace \
261 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100262 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100263 [System.IO.File]::WriteAllText(\"$@\", $$out, \
264 [System.Text.Encoding]::GetEncoding(1250))
265
266# Convert zh_CN.UTF-8.po to create zh_CN.po.
267zh_CN.po: zh_CN.UTF-8.po
268 -$(RM) $@
269!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
270 "$(GETTEXT_PATH)\msgconv.exe" -t GB2312 -o $@ $?
271!ELSE
272! IF DEFINED (ICONV)
273 $(ICONV) -f UTF-8 -t GB2312 $? > $@
274! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100275 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100276 [System.IO.File]::ReadAllText(\"$?\", \
277 [System.Text.Encoding]::GetEncoding(65001)), \
278 [System.Text.Encoding]::GetEncoding(936))
279
280! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100281 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100282 [System.Text.Encoding]::GetEncoding(936)) -replace \
283 'charset=UTF-8', 'charset=GB2312'; \
284 [System.IO.File]::WriteAllText(\"$@\", $$out, \
285 [System.Text.Encoding]::GetEncoding(936))
286!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100287 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100288 [System.Text.Encoding]::GetEncoding(936)) -replace \
289 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100290 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100291 [System.IO.File]::WriteAllText(\"$@\", $$out, \
292 [System.Text.Encoding]::GetEncoding(936))
293
294# Convert zh_CN.UTF-8.po to create zh_CN.cp936.po.
295# Set 'charset' to gbk to avoid that msfmt generates a warning.
296# This used to convert from zh_CN.po, but that results in a conversion error.
297zh_CN.cp936.po: zh_CN.UTF-8.po
298 -$(RM) $@
299!IF DEFINED (ICONV)
300 $(ICONV) -f UTF-8 -t CP936 $? > $@
301!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100302 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100303 [System.IO.File]::ReadAllText(\"$?\", \
304 [System.Text.Encoding]::GetEncoding(65001)), \
305 [System.Text.Encoding]::GetEncoding(20936))
306
307!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100308 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100309 [System.Text.Encoding]::GetEncoding(20936)) \
310 -replace 'charset=UTF-8', 'charset=GBK'\
311 -replace '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100312 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100313 [System.IO.File]::WriteAllText(\"$@\", $$out, \
314 [System.Text.Encoding]::GetEncoding(20936))
315
316# Convert zh_TW.UTF-8.po to create zh_TW.po
317zh_TW.po: zh_TW.UTF-8.po
318 -$(RM) $@
319!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
320 "$(GETTEXT_PATH)\msgconv.exe" -t BIG5 -o $@ $?
321!ELSE
322! IF DEFINED (ICONV)
323 $(ICONV) -f UTF-8 -t BIG5 $? > $@
324! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100325 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100326 [System.IO.File]::ReadAllText(\"$?\", \
327 [System.Text.Encoding]::GetEncoding(65001)), \
328 [System.Text.Encoding]::GetEncoding(950))
329
330! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100331 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100332 [System.Text.Encoding]::GetEncoding(950)) -replace \
333 'charset=UTF-8', 'charset=BIG5'; \
334 [System.IO.File]::WriteAllText(\"$@\", $$out, \
335 [System.Text.Encoding]::GetEncoding(950))
336!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100337 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100338 [System.Text.Encoding]::GetEncoding(950)) -replace \
339 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100340 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100341 [System.IO.File]::WriteAllText(\"$@\", $$out, \
342 [System.Text.Encoding]::GetEncoding(950))
343
344# Convert zh_TW.UTF-8.po to create zh_TW.po with backslash characters
345# Requires doubling backslashes in the second byte. Don't depend on big5corr,
346# it should only be compiled when zh_TW.po is outdated.
RestorerZ76ba7242024-01-22 20:28:12 +0100347
RestorerZe2146922023-11-23 20:58:32 +0100348#
349# 06.11.23, added by Restorer:
350# For more details, see:
351# https://github.com/vim/vim/pull/3261
352# https://github.com/vim/vim/pull/3476
353# https://github.com/vim/vim/pull/12153
354# (read all comments)
355#
356# I checked the workability on the list of backslash characters
357# specified in zh_TW.UTF-8.po. It works.
358# But it is better to have someone native speaker check it.
359#
360
361#zh_TW.po: zh_TW.UTF-8.po
362# @$(MAKE) -nologo -f Make_mvc.mak big5corr
363# -$(RM) $@
364#!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
365# "$(GETTEXT_PATH)\msgconv.exe" -t BIG5 $? | .\big5corr.exe > $@
366#!ELSEIF DEFINED (ICONV)
367# $(ICONV) -f UTF-8 -t BIG5 $? | .\big5corr.exe > $@
368#!ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100369# $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100370# [System.IO.File]::ReadAllText(\"$?\", \
371# [System.Text.Encoding]::GetEncoding(65001)), \
372# [System.Text.Encoding]::GetEncoding(950))
373# type $@ | .\big5corr.exe > tmp.$@
374# @$(MV) tmp.$@ $@
375#!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100376# $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100377# [System.Text.Encoding]::GetEncoding(950)) \
378# -replace \"`r`n\", \"`n\"; \
379# [System.IO.File]::WriteAllText(\"$@\", $$out, \
380# [System.Text.Encoding]::GetEncoding(950))
381
382# see above in the zh_TW.po conversion section for backslashes.
383#big5corr: big5corr.c
384# $(CC) big5corr.c
385
386# Convert ko.UTF-8.po to create ko.po.
387ko.po: ko.UTF-8.po
388 -$(RM) $@
389!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
390 "$(GETTEXT_PATH)\msgconv.exe" -t EUC-KR -o $@ $?
391!ELSE
392! IF DEFINED (ICONV)
393 $(ICONV) -f UTF-8 -t EUC-KR $? > $@
394! 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(51949))
399
400! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100401 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100402 [System.Text.Encoding]::GetEncoding(51949)) -replace \
403 'charset=UTF-8', 'charset=EUC-KR'; \
404 [System.IO.File]::WriteAllText(\"$@\", $$out, \
405 [System.Text.Encoding]::GetEncoding(51949))
406!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100407 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100408 [System.Text.Encoding]::GetEncoding(51949)) -replace \
409 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100410 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100411 [System.IO.File]::WriteAllText(\"$@\", $$out, \
412 [System.Text.Encoding]::GetEncoding(51949))
413
414# Convert ru.po to create ru.cp1251.po.
415ru.cp1251.po: ru.po
416 -$(RM) $@
417!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
418 "$(GETTEXT_PATH)\msgconv.exe" -t CP1251 -o $@ $?
419!ELSE
420! IF DEFINED (ICONV)
421 $(ICONV) -f UTF-8 -t CP1251 $? > $@
422! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100423 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100424 [System.IO.File]::ReadAllText(\"$?\", \
425 [System.Text.Encoding]::GetEncoding(65001)), \
426 [System.Text.Encoding]::GetEncoding(1251))
427
428! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100429 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100430 [System.Text.Encoding]::GetEncoding(1251)) -replace \
431 'charset=UTF-8', 'charset=CP1251'; \
432 [System.IO.File]::WriteAllText(\"$@\", $$out, \
433 [System.Text.Encoding]::GetEncoding(1251))
434!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100435 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100436 [System.Text.Encoding]::GetEncoding(1251)) -replace \
437 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100438 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100439 [System.IO.File]::WriteAllText(\"$@\", $$out, \
440 [System.Text.Encoding]::GetEncoding(1251))
441
442# Convert uk.po to create uk.cp1251.po.
443uk.cp1251.po: uk.po
444 -$(RM) $@
445!IF EXIST ("$(GETTEXT_PATH)\msgconv.exe")
446 "$(GETTEXT_PATH)\msgconv.exe" -t CP1251 -o $@ $?
447!ELSE
448! IF DEFINED (ICONV)
449 $(ICONV) -f UTF-8 -t CP1251 $? > $@
450! ELSE
RestorerZ76ba7242024-01-22 20:28:12 +0100451 $(PS) $(PSFLAGS) [System.IO.File]::WriteAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100452 [System.IO.File]::ReadAllText(\"$?\", \
453 [System.Text.Encoding]::GetEncoding(65001)), \
454 [System.Text.Encoding]::GetEncoding(1251))
455
456! ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100457 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100458 [System.Text.Encoding]::GetEncoding(1251)) -replace \
459 'charset=UTF-8', 'charset=CP1251'; \
460 [System.IO.File]::WriteAllText(\"$@\", $$out, \
461 [System.Text.Encoding]::GetEncoding(1251))
462!ENDIF
RestorerZ76ba7242024-01-22 20:28:12 +0100463 $(PS) $(PSFLAGS) $$out = [System.IO.File]::ReadAllText(\"$@\", \
RestorerZe2146922023-11-23 20:58:32 +0100464 [System.Text.Encoding]::GetEncoding(1251)) -replace \
465 '# Original translations', \
RestorerZ76ba7242024-01-22 20:28:12 +0100466 '# Generated from $?, DO NOT EDIT'; \
RestorerZe2146922023-11-23 20:58:32 +0100467 [System.IO.File]::WriteAllText(\"$@\", $$out, \
468 [System.Text.Encoding]::GetEncoding(1251))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000469
470.po.mo:
Bram Moolenaar01380622015-12-29 16:04:42 +0100471 set OLD_PO_FILE_INPUT=yes
Bram Moolenaar071d4272004-06-13 20:20:40 +0000472 $(MSGFMT) -o $@ $<
473
Bram Moolenaarfa573352020-09-04 13:53:00 +0200474PO_INPUTLIST = \
475 ..\*.c \
476 ..\if_perl.xs \
477 ..\GvimExt\gvimext.cpp \
478 ..\errors.h \
479 ..\globals.h \
480 ..\if_py_both.h \
481 ..\vim.h \
482 gvim.desktop.in \
483 vim.desktop.in
484
Bram Moolenaar167fb6d2023-05-23 15:27:51 +0100485files: $(PO_INPUTLIST)
Bram Moolenaarfa573352020-09-04 13:53:00 +0200486 $(LS) $(LSFLAGS) $(PO_INPUTLIST) > .\files
Bram Moolenaar071d4272004-06-13 20:20:40 +0000487
RestorerZ76ba7242024-01-22 20:28:12 +0100488first_time: files
489 "$(VIM)" -u NONE --not-a-term -S tojavascript.vim $(LANGUAGE).po \
RestorerZe2146922023-11-23 20:58:32 +0100490 $(PO_VIM_INPUTLIST)
Bram Moolenaar01380622015-12-29 16:04:42 +0100491 set OLD_PO_FILE_INPUT=yes
492 set OLD_PO_FILE_OUTPUT=yes
RestorerZe2146922023-11-23 20:58:32 +0100493 $(XGETTEXT) --default-domain=$(LANGUAGE) --add-comments $(XGETTEXT_KEYWORDS) \
494 --files-from=.\files $(PO_VIM_JSLIST)
RestorerZ76ba7242024-01-22 20:28:12 +0100495 "$(VIM)" -u NONE --not-a-term -S fixfilenames.vim $(LANGUAGE).po \
RestorerZe2146922023-11-23 20:58:32 +0100496 $(PO_VIM_INPUTLIST)
Bram Moolenaarfa573352020-09-04 13:53:00 +0200497 $(RM) *.js
Bram Moolenaar071d4272004-06-13 20:20:40 +0000498
Bram Moolenaarfa573352020-09-04 13:53:00 +0200499$(PACKAGE).pot: files
RestorerZ76ba7242024-01-22 20:28:12 +0100500 "$(VIM)" -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot \
RestorerZe2146922023-11-23 20:58:32 +0100501 $(PO_VIM_INPUTLIST)
Bram Moolenaar01380622015-12-29 16:04:42 +0100502 set OLD_PO_FILE_INPUT=yes
503 set OLD_PO_FILE_OUTPUT=yes
RestorerZe2146922023-11-23 20:58:32 +0100504 $(XGETTEXT) --default-domain=$(PACKAGE) --add-comments $(XGETTEXT_KEYWORDS) \
505 --files-from=.\files $(PO_VIM_JSLIST)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000506 $(MV) $(PACKAGE).po $(PACKAGE).pot
RestorerZ76ba7242024-01-22 20:28:12 +0100507 "$(VIM)" -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot \
RestorerZe2146922023-11-23 20:58:32 +0100508 $(PO_VIM_INPUTLIST)
Bram Moolenaarfa573352020-09-04 13:53:00 +0200509 $(RM) *.js
510
RestorerZ76ba7242024-01-22 20:28:12 +0100511# Only original translations with default encoding should be updated.
RestorerZe2146922023-11-23 20:58:32 +0100512# The files that are converted to a different encoding clearly state "DO NOT EDIT".
513update-po: $(MOFILES:.mo=)
514
Bram Moolenaarfa573352020-09-04 13:53:00 +0200515# Don't add a dependency here, we only want to update the .po files manually
516$(LANGUAGES):
RestorerZ76ba7242024-01-22 20:28:12 +0100517 @$(MAKE) -nologo -f Make_mvc.mak GETTEXT_PATH="$(GETTEXT_PATH)" $(PACKAGE).pot
Bram Moolenaar071d4272004-06-13 20:20:40 +0000518 $(CP) $@.po $@.po.orig
519 $(MV) $@.po $@.po.old
520 $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po
521 $(RM) $@.po.old
522
RestorerZ76ba7242024-01-22 20:28:12 +0100523install: $(LANGUAGE).mo
Bram Moolenaar071d4272004-06-13 20:20:40 +0000524 if not exist $(INSTALLDIR) $(MKD) $(INSTALLDIR)
525 $(CP) $(LANGUAGE).mo $(INSTALLDIR)\$(PACKAGE).mo
526
Bram Moolenaar01380622015-12-29 16:04:42 +0100527install-all: all
RestorerZe2146922023-11-23 20:58:32 +0100528 for %%l in ($(LANGUAGES)) do @if not exist $(VIMRUNTIME)\lang\%%l\LC_MESSAGES \
529 $(MKD) $(VIMRUNTIME)\lang\%%l\LC_MESSAGES
530 for %%l in ($(LANGUAGES)) do @$(CP) %%l.mo \
531 $(VIMRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo
Bram Moolenaar01380622015-12-29 16:04:42 +0100532
RestorerZ76ba7242024-01-22 20:28:12 +0100533cleanup-po: $(LANGUAGE).po
534 "$(VIM)" -u NONE -e -X -S cleanup.vim -c wq $(LANGUAGE).po
RestorerZe2146922023-11-23 20:58:32 +0100535
536cleanup-po-all: $(POFILES)
RestorerZ76ba7242024-01-22 20:28:12 +0100537 !"$(VIM)" -u NONE -e -X -S cleanup.vim -c wq $**
RestorerZe2146922023-11-23 20:58:32 +0100538
539clean: checkclean
Bram Moolenaar071d4272004-06-13 20:20:40 +0000540 $(RM) *.mo
541 $(RM) *.pot
RestorerZ76ba7242024-01-22 20:28:12 +0100542 $(RM) *.orig
Bram Moolenaarfa573352020-09-04 13:53:00 +0200543 $(RM) files
RestorerZe2146922023-11-23 20:58:32 +0100544 $(RM) sjiscorr.obj sjiscorr.exe
545# $(RM) big5corr.obj big5corr.exe
546
547# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0 ft=make: