mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 13:15:09 -07:00
Move po generation from Make to CMake.
Fixes #902: localization build: `install`, `uninstall`, `prefixcheck targets. All the language-related bits will now build under CMake. Changes include: * Moving all non-generated sources into the NEOVIM_SOURCES variable to aid in generating the .pot file. * Moving a couple generated sources from NEOVIM_SOURCES and into NEOVIM_GENERATED_SOURCES. * Added NEOVIM_HEADERS to the executable and the library for folks who are using something other than Ninja or makefiles (that way the headers will show up in the IDE files). * Now uses gettext's `--update` switch to update the .po files, rather than doing a fragile `mv` dance that could leave you with a broken working tree if you press CTRL-C at the right time. * Creates `update-po-${LANG}` targets for updating individual languages, just like the original Makefile. * Also adds the `update-po` target for updating all the languages. * Ported the `check-${LANG}` style targets. They're `check-po-${LANG}` under CMake. * Handles all the one-off instances that were in the original Makefile. Fixed up ko.UTF-8.po to include the "Original translation" line like other .po files to make the generation of the "Generate from ..." comments consistent. Updated ko.po with the new text.
This commit is contained in:
parent
a3b3db8256
commit
67533e0948
21
cmake/ConvertPo.cmake
Normal file
21
cmake/ConvertPo.cmake
Normal file
@ -0,0 +1,21 @@
|
||||
string(TOUPPER ${INPUT_ENC} upperInputEnc)
|
||||
string(TOLOWER ${INPUT_ENC} lowerInputEnc)
|
||||
get_filename_component(inputName ${INPUT_FILE} NAME)
|
||||
execute_process(
|
||||
COMMAND ${ICONV_PRG} -f ${INPUT_ENC} -t ${OUTPUT_ENC} ${INPUT_FILE}
|
||||
OUTPUT_VARIABLE trans
|
||||
ERROR_VARIABLE err
|
||||
RESULT_VARIABLE res)
|
||||
if(NOT res EQUAL 0)
|
||||
message(FATAL_ERROR "iconv failed to run correctly: ${err}")
|
||||
endif()
|
||||
|
||||
string(REPLACE "charset=${lowerInputEnc}" "charset=${OUTPUT_CHARSET}"
|
||||
trans "${trans}")
|
||||
string(REPLACE "charset=${upperInputEnc}" "charset=${OUTPUT_CHARSET}"
|
||||
trans "${trans}")
|
||||
string(REPLACE "# Original translations"
|
||||
"# Generated from ${inputName}, DO NOT EDIT"
|
||||
trans "${trans}")
|
||||
|
||||
file(WRITE ${OUTPUT_FILE} "${trans}")
|
9
cmake/RunMsgfmt.cmake
Normal file
9
cmake/RunMsgfmt.cmake
Normal file
@ -0,0 +1,9 @@
|
||||
set(ENV{OLD_PO_FILE_INPUT} yes)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${MSGFMT_PRG} -o ${MO_FILE} ${PO_FILE}
|
||||
ERROR_VARIABLE err
|
||||
RESULT_VARIABLE res)
|
||||
if(NOT res EQUAL 0)
|
||||
message(FATAL_ERROR "msgfmt failed to run correctly: ${err}")
|
||||
endif()
|
11
cmake/RunMsgmerge.cmake
Normal file
11
cmake/RunMsgmerge.cmake
Normal file
@ -0,0 +1,11 @@
|
||||
set(ENV{OLD_PO_FILE_INPUT} yes)
|
||||
set(ENV{OLD_PO_FILE_OUTPUT} yes)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${MSGMERGE_PRG} -q --update --backup=none --sort-by-file
|
||||
${PO_FILE} ${POT_FILE}
|
||||
ERROR_VARIABLE err
|
||||
RESULT_VARIABLE res)
|
||||
if(NOT res EQUAL 0)
|
||||
message(FATAL_ERROR "msgmerge failed to run correctly: ${err}")
|
||||
endif()
|
14
cmake/RunXgettext.cmake
Normal file
14
cmake/RunXgettext.cmake
Normal file
@ -0,0 +1,14 @@
|
||||
set(ENV{OLD_PO_FILE_INPUT} yes)
|
||||
set(ENV{OLD_PO_FILE_OUTPUT} yes)
|
||||
|
||||
list(SORT SOURCES)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${XGETTEXT_PRG} -o ${POT_FILE} --default-domain=nvim
|
||||
--add-comments --keyword=_ --keyword=N_ -D ${SEARCH_DIR}
|
||||
${SOURCES}
|
||||
ERROR_VARIABLE err
|
||||
RESULT_VARIABLE res)
|
||||
if(NOT res EQUAL 0)
|
||||
message(FATAL_ERROR "xgettext failed to run correctly: ${err}")
|
||||
endif()
|
@ -20,7 +20,8 @@ file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/os)
|
||||
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/api)
|
||||
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/api/private)
|
||||
|
||||
file( GLOB NEOVIM_SOURCES *.c )
|
||||
file(GLOB NEOVIM_SOURCES *.c os/*.c api/*.c api/private/*.c)
|
||||
file(GLOB_RECURSE NEOVIM_HEADERS *.h)
|
||||
|
||||
foreach(sfile ${NEOVIM_SOURCES})
|
||||
get_filename_component(f ${sfile} NAME)
|
||||
@ -31,10 +32,6 @@ endforeach()
|
||||
|
||||
list(REMOVE_ITEM NEOVIM_SOURCES ${to_remove})
|
||||
|
||||
file( GLOB OS_SOURCES os/*.c )
|
||||
file( GLOB API_SOURCES api/*.c )
|
||||
file( GLOB API_PRIV_SOURCES api/private/*.c )
|
||||
|
||||
set(CONV_SRCS
|
||||
api.c
|
||||
arabic.c
|
||||
@ -95,10 +92,7 @@ endforeach()
|
||||
set(gen_cflags "${gen_cflags} ${CMAKE_C_FLAGS}")
|
||||
|
||||
foreach(sfile ${NEOVIM_SOURCES}
|
||||
"${PROJECT_SOURCE_DIR}/src/nvim/regexp_nfa.c"
|
||||
${OS_SOURCES}
|
||||
${API_SOURCES}
|
||||
${API_PRIV_SOURCES})
|
||||
"${PROJECT_SOURCE_DIR}/src/nvim/regexp_nfa.c")
|
||||
get_filename_component(full_d ${sfile} PATH)
|
||||
file(RELATIVE_PATH d "${PROJECT_SOURCE_DIR}/src/nvim" "${full_d}")
|
||||
get_filename_component(f ${sfile} NAME)
|
||||
@ -131,8 +125,9 @@ add_custom_command(OUTPUT ${MSGPACK_DISPATCH}
|
||||
${DISPATCH_GENERATOR}
|
||||
)
|
||||
|
||||
list(APPEND NEOVIM_SOURCES "${PROJECT_BINARY_DIR}/config/auto/pathdef.c")
|
||||
list(APPEND NEOVIM_SOURCES "${MSGPACK_DISPATCH}")
|
||||
list(APPEND NEOVIM_GENERATED_SOURCES
|
||||
"${PROJECT_BINARY_DIR}/config/auto/pathdef.c"
|
||||
"${MSGPACK_DISPATCH}")
|
||||
|
||||
# Our dependencies come first.
|
||||
|
||||
@ -163,13 +158,15 @@ list(APPEND NVIM_LINK_LIBRARIES
|
||||
|
||||
if(NOT DEFINED ENV{SKIP_EXEC})
|
||||
add_executable(nvim ${NEOVIM_GENERATED_SOURCES} ${NEOVIM_SOURCES}
|
||||
${OS_SOURCES} ${API_SOURCES} ${API_PRIV_SOURCES})
|
||||
${NEOVIM_HEADERS})
|
||||
target_link_libraries(nvim ${NVIM_LINK_LIBRARIES})
|
||||
install(TARGETS nvim RUNTIME DESTINATION bin)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED ENV{SKIP_UNITTEST})
|
||||
add_library(nvim-test MODULE EXCLUDE_FROM_ALL ${NEOVIM_GENERATED_SOURCES}
|
||||
${NEOVIM_SOURCES} ${OS_SOURCES} ${API_SOURCES} ${API_PRIV_SOURCES})
|
||||
${NEOVIM_SOURCES} ${NEOVIM_HEADERS})
|
||||
target_link_libraries(nvim-test ${NVIM_LINK_LIBRARIES})
|
||||
endif()
|
||||
|
||||
add_subdirectory(po)
|
||||
|
206
src/nvim/po/CMakeLists.txt
Normal file
206
src/nvim/po/CMakeLists.txt
Normal file
@ -0,0 +1,206 @@
|
||||
find_package(Gettext)
|
||||
find_program(XGETTEXT_PRG xgettext)
|
||||
find_program(ICONV_PRG iconv)
|
||||
|
||||
if(HAVE_WORKING_LIBINTL AND GETTEXT_FOUND AND XGETTEXT_PRG AND ICONV_PRG AND
|
||||
NOT DEFINED ENV{SKIP_EXEC})
|
||||
set(ENV{OLD_PO_FILE_INPUT} yes)
|
||||
set(ENV{OLD_PO_FILE_OUTPUT} yes)
|
||||
|
||||
set(LANGUAGES
|
||||
af
|
||||
ca
|
||||
cs
|
||||
de
|
||||
en_GB
|
||||
eo
|
||||
es
|
||||
fi
|
||||
fr
|
||||
ga
|
||||
it
|
||||
ja
|
||||
ko.UTF-8
|
||||
nl
|
||||
no
|
||||
pl
|
||||
pt_BR
|
||||
ru
|
||||
sk
|
||||
sv
|
||||
uk
|
||||
vi
|
||||
zh_CN
|
||||
zh_CN.UTF-8
|
||||
zh_TW
|
||||
zh_TW.UTF-8)
|
||||
|
||||
set(NEOVIM_RELATIVE_SOURCES)
|
||||
foreach(SRC ${NEOVIM_SOURCES} ${NEOVIM_HEADERS})
|
||||
file(RELATIVE_PATH RELATIVE_SRC ${CMAKE_CURRENT_SOURCE_DIR} ${SRC})
|
||||
list(APPEND NEOVIM_RELATIVE_SOURCES ${RELATIVE_SRC})
|
||||
endforeach()
|
||||
|
||||
set(NVIM_POT ${CMAKE_CURRENT_BINARY_DIR}/nvim.pot)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT nvim.pot
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DXGETTEXT_PRG=${XGETTEXT_PRG}
|
||||
-DPOT_FILE=${NVIM_POT}
|
||||
-DSEARCH_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
"'-DSOURCES=${NEOVIM_RELATIVE_SOURCES}'"
|
||||
-P ${CMAKE_MODULE_PATH}/RunXgettext.cmake
|
||||
DEPENDS ${NEOVIM_SOURCES})
|
||||
|
||||
add_custom_target(potfile DEPENDS ${NVIM_POT})
|
||||
|
||||
set(LANGUAGE_MO_FILES)
|
||||
set(UPDATE_PO_TARGETS)
|
||||
|
||||
macro(BuildMo name)
|
||||
set(poFile ${CMAKE_CURRENT_SOURCE_DIR}/${name}.po)
|
||||
set(moFile ${CMAKE_CURRENT_BINARY_DIR}/${name}.mo)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${moFile}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DMSGFMT_PRG=${GETTEXT_MSGFMT_EXECUTABLE}
|
||||
-DMO_FILE=${moFile}
|
||||
-DPO_FILE=${poFile}
|
||||
-P ${CMAKE_MODULE_PATH}/RunMsgfmt.cmake
|
||||
DEPENDS ${poFile} ${NVIM_POT})
|
||||
|
||||
install(
|
||||
FILES ${moFile}
|
||||
DESTINATION share/locale/${name}/LC_MESSAGES
|
||||
RENAME nvim.mo)
|
||||
|
||||
list(APPEND LANGUAGE_MO_FILES ${moFile})
|
||||
endmacro()
|
||||
|
||||
macro(CheckPo name)
|
||||
set(poFile ${CMAKE_CURRENT_SOURCE_DIR}/${name}.po)
|
||||
|
||||
add_custom_target(check-po-${name}
|
||||
COMMAND $<TARGET_FILE:nvim> -u NONE -n -e -X
|
||||
-S ${CMAKE_CURRENT_SOURCE_DIR}/check.vim
|
||||
-c "if error == 0 | q | endif" -c cq ${poFile} ||
|
||||
${CMAKE_COMMAND} -E echo "${name}.po failed the check."
|
||||
COMMENT "Checking ${name}.po"
|
||||
VERBATIM
|
||||
DEPENDS ${poFile})
|
||||
endmacro()
|
||||
|
||||
macro(BuildPoIconvGenericWithCharset
|
||||
lang inputName outputName inputEnc outputEnc outputCharSet)
|
||||
set(inputFile ${CMAKE_CURRENT_SOURCE_DIR}/${inputName}.po)
|
||||
set(outputFile ${CMAKE_CURRENT_SOURCE_DIR}/${outputName}.po)
|
||||
string(TOUPPER ${inputEnc} upperInputEnc)
|
||||
string(TOLOWER ${inputEnc} lowerInputEnc)
|
||||
|
||||
add_custom_target(update-po-${lang}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DICONV_PRG=${ICONV_PRG}
|
||||
-DINPUT_FILE=${inputFile}
|
||||
-DOUTPUT_FILE=${outputFile}
|
||||
-DINPUT_ENC=${inputEnc}
|
||||
-DOUTPUT_ENC=${outputEnc}
|
||||
-DOUTPUT_CHARSET=${outputCharSet}
|
||||
-P ${CMAKE_MODULE_PATH}/ConvertPo.cmake
|
||||
COMMENT "Updating ${outputName}.po"
|
||||
DEPENDS ${inputFile})
|
||||
|
||||
CheckPo(${outputName})
|
||||
|
||||
list(APPEND UPDATE_PO_TARGETS update-po-${lang})
|
||||
endmacro()
|
||||
|
||||
macro(BuildPoIconvGeneric lang inputName outputName inputEnc outputEnc)
|
||||
# Most of the time, the output charset is the same as the iconv output
|
||||
# encoding.
|
||||
BuildPoIconvGenericWithCharset(
|
||||
${lang} ${inputName} ${outputName} ${inputEnc} ${outputEnc} ${outputEnc})
|
||||
endmacro()
|
||||
|
||||
macro(BuildPoIconv name inputEnc outputEnc)
|
||||
set(lang ${name}.${outputEnc})
|
||||
set(inputName ${name})
|
||||
|
||||
if(outputEnc STREQUAL utf-8)
|
||||
set(outputName ${name}.UTF-8)
|
||||
else()
|
||||
set(outputName ${lang})
|
||||
endif()
|
||||
|
||||
BuildPoIconvGeneric(
|
||||
${lang} ${inputName} ${outputName} ${inputEnc} ${outputEnc})
|
||||
endmacro()
|
||||
|
||||
# Create some translations from others.
|
||||
BuildPoIconv(ja utf-8 euc-jp)
|
||||
BuildMo(ja.euc-jp)
|
||||
|
||||
BuildPoIconv(cs ISO-8859-2 cp1250)
|
||||
BuildMo(cs.cp1250)
|
||||
|
||||
BuildPoIconv(pl ISO-8859-2 cp1250)
|
||||
BuildMo(pl.cp1250)
|
||||
|
||||
BuildPoIconv(pl ISO-8859-2 UTF-8)
|
||||
BuildMo(pl.UTF-8)
|
||||
|
||||
BuildPoIconv(sk ISO-8859-2 cp1250)
|
||||
BuildMo(sk.cp1250)
|
||||
|
||||
BuildPoIconv(ru UTF-8 cp1251)
|
||||
BuildMo(ru.cp1251)
|
||||
|
||||
BuildPoIconv(uk UTF-8 cp1251)
|
||||
BuildMo(uk.cp1251)
|
||||
|
||||
BuildPoIconvGeneric(ko ko.UTF-8 ko UTF-8 euc-kr)
|
||||
BuildMo(ko)
|
||||
|
||||
BuildPoIconvGenericWithCharset(zh_CN.cp936 zh_CN zh_CN.cp936 gb2312 cp936 gbk)
|
||||
BuildMo(zh_CN.cp936)
|
||||
|
||||
add_custom_target(update-po-nb
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/no.po ${CMAKE_CURRENT_SOURCE_DIR}/nb.po
|
||||
DEPENDS no.po)
|
||||
list(APPEND UPDATE_PO_TARGETS update-po-nb)
|
||||
CheckPo(nb)
|
||||
BuildMo(nb)
|
||||
|
||||
add_executable(sjiscorr sjiscorr.c)
|
||||
add_custom_target(update-po-ja.sjis
|
||||
COMMAND iconv -f utf-8 -t cp932 ${CMAKE_CURRENT_SOURCE_DIR}/ja.po |
|
||||
$<TARGET_FILE:sjiscorr> > ${CMAKE_CURRENT_SOURCE_DIR}/ja.sjis.po
|
||||
DEPENDS ja.po sjiscorr)
|
||||
list(APPEND UPDATE_PO_TARGETS update-po-ja.sjis)
|
||||
CheckPo(ja.sjis)
|
||||
BuildMo(ja.sjis)
|
||||
|
||||
foreach(LANGUAGE ${LANGUAGES})
|
||||
set(poFile "${CMAKE_CURRENT_SOURCE_DIR}/${LANGUAGE}.po")
|
||||
|
||||
add_custom_target(update-po-${LANGUAGE}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DMSGMERGE_PRG=${GETTEXT_MSGMERGE_EXECUTABLE}
|
||||
-DPO_FILE=${poFile}
|
||||
-DPOT_FILE=${NVIM_POT}
|
||||
-P ${CMAKE_MODULE_PATH}/RunMsgmerge.cmake
|
||||
COMMENT "Updating ${LANGUAGE}.po"
|
||||
DEPENDS ${NVIM_POT})
|
||||
|
||||
CheckPo(${LANGUAGE})
|
||||
|
||||
list(APPEND UPDATE_PO_TARGETS update-po-${LANGUAGE})
|
||||
|
||||
BuildMo(${LANGUAGE})
|
||||
endforeach()
|
||||
|
||||
add_custom_target(translations ALL DEPENDS ${LANGUAGE_MO_FILES})
|
||||
add_custom_target(update-po DEPENDS ${UPDATE_PO_TARGETS})
|
||||
endif()
|
@ -1,295 +0,0 @@
|
||||
# Makefile for the Vim message translations.
|
||||
|
||||
# TODO make this configurable
|
||||
# Note: ja.sjis, *.cp1250 and zh_CN.cp936 are only for MS-Windows, they are
|
||||
# not installed on Unix
|
||||
|
||||
LANGUAGES = \
|
||||
af \
|
||||
ca \
|
||||
cs \
|
||||
de \
|
||||
en_GB \
|
||||
eo \
|
||||
es \
|
||||
fi \
|
||||
fr \
|
||||
ga \
|
||||
it \
|
||||
ja \
|
||||
ko \
|
||||
ko.UTF-8 \
|
||||
nb \
|
||||
nl \
|
||||
no \
|
||||
pl \
|
||||
pt_BR \
|
||||
ru \
|
||||
sk \
|
||||
sv \
|
||||
uk \
|
||||
vi \
|
||||
zh_CN \
|
||||
zh_CN.UTF-8 \
|
||||
zh_TW \
|
||||
zh_TW.UTF-8
|
||||
|
||||
CONVERTED = \
|
||||
cs.cp1250 \
|
||||
ja.sjis \
|
||||
ja.euc-jp \
|
||||
pl.cp1250 \
|
||||
pl.UTF-8 \
|
||||
ru.cp1251 \
|
||||
sk.cp1250 \
|
||||
uk.cp1251 \
|
||||
zh_CN.cp936
|
||||
|
||||
MOFILES = \
|
||||
af.mo \
|
||||
ca.mo \
|
||||
cs.mo \
|
||||
de.mo \
|
||||
en_GB.mo \
|
||||
eo.mo \
|
||||
es.mo \
|
||||
fi.mo \
|
||||
fr.mo \
|
||||
ga.mo \
|
||||
it.mo \
|
||||
ja.mo \
|
||||
ko.mo \
|
||||
ko.UTF-8.mo \
|
||||
nb.mo \
|
||||
nl.mo \
|
||||
no.mo \
|
||||
pl.mo \
|
||||
pt_BR.mo \
|
||||
ru.mo \
|
||||
sk.mo \
|
||||
sv.mo \
|
||||
uk.mo \
|
||||
vi.mo \
|
||||
zh_CN.UTF-8.mo \
|
||||
zh_CN.mo \
|
||||
zh_TW.UTF-8.mo \
|
||||
zh_TW.mo
|
||||
|
||||
MOCONVERTED = \
|
||||
cs.cp1250.mo \
|
||||
ja.sjis.mo \
|
||||
ja.euc-jp.mo \
|
||||
pl.cp1250.mo \
|
||||
pl.UTF-8.mo \
|
||||
ru.cp1251.mo \
|
||||
sk.cp1250.mo \
|
||||
uk.cp1251.mo \
|
||||
zh_CN.cp936.mo
|
||||
|
||||
CHECKFILES = \
|
||||
af.ck \
|
||||
ca.ck \
|
||||
cs.ck \
|
||||
de.ck \
|
||||
en_GB.ck \
|
||||
eo.ck \
|
||||
es.ck \
|
||||
fi.ck \
|
||||
fr.ck \
|
||||
ga.ck \
|
||||
it.ck \
|
||||
ja.ck \
|
||||
ko.ck \
|
||||
ko.UTF-8.ck \
|
||||
nb.ck \
|
||||
nl.ck \
|
||||
no.ck \
|
||||
pl.ck \
|
||||
pt_BR.ck \
|
||||
ru.ck \
|
||||
sk.ck \
|
||||
sv.ck \
|
||||
uk.ck \
|
||||
vi.ck \
|
||||
zh_CN.UTF-8.ck \
|
||||
zh_CN.ck \
|
||||
zh_TW.UTF-8.ck \
|
||||
zh_TW.ck \
|
||||
cs.cp1250.ck \
|
||||
ja.sjis.ck \
|
||||
ja.euc-jp.ck \
|
||||
pl.cp1250.ck \
|
||||
pl.UTF-8.ck \
|
||||
ru.cp1251.ck \
|
||||
sk.cp1250.ck \
|
||||
uk.cp1251.ck \
|
||||
zh_CN.cp936.ck
|
||||
|
||||
SOURCE_FILES = $(shell find .. -type f -name '*.[ch]')
|
||||
|
||||
PACKAGE = nvim
|
||||
SHELL = /bin/sh
|
||||
VIM = ../../../build/bin/nvim
|
||||
|
||||
# The OLD_PO_FILE_INPUT and OLD_PO_FILE_OUTPUT are for the new GNU gettext
|
||||
# tools 0.10.37, which use a slightly different .po file format that is not
|
||||
# compatible with Solaris (and old gettext implementations) unless these are
|
||||
# set. gettext 0.10.36 will not work!
|
||||
MSGFMT = OLD_PO_FILE_INPUT=yes msgfmt -v
|
||||
XGETTEXT = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes xgettext
|
||||
MSGMERGE = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes msgmerge
|
||||
SAFE_SED = LANG=C LC_CTYPE=C LC_ALL=C sed
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .po .mo .pot .ck
|
||||
.PHONY: all install uninstall prefixcheck converted check clean checkclean distclean update-po $(LANGUAGES) $(CONVERTED)
|
||||
|
||||
.po.mo:
|
||||
$(MSGFMT) -o $@ $<
|
||||
|
||||
.po.ck:
|
||||
$(VIM) -u NONE -e -X -S check.vim -c "if error == 0 | q | endif" -c cq $<
|
||||
touch $@
|
||||
|
||||
all: $(MOFILES) $(MOCONVERTED)
|
||||
|
||||
check: $(CHECKFILES)
|
||||
|
||||
install: $(MOFILES) $(MOCONVERTED)
|
||||
@$(MAKE) prefixcheck
|
||||
for lang in $(LANGUAGES) $(CONVERTED); do \
|
||||
dir=$(LOCALEDIR)/$$lang/; \
|
||||
if test ! -x "$$dir"; then \
|
||||
mkdir $$dir; chmod 755 $$dir; \
|
||||
fi; \
|
||||
dir=$(LOCALEDIR)/$$lang/LC_MESSAGES; \
|
||||
if test ! -x "$$dir"; then \
|
||||
mkdir $$dir; chmod 755 $$dir; \
|
||||
fi; \
|
||||
if test -r $$lang.mo; then \
|
||||
$(INSTALL_DATA) $$lang.mo $$dir/$(PACKAGE).mo; \
|
||||
chmod $(FILEMOD) $$dir/$(PACKAGE).mo; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
uninstall:
|
||||
@$(MAKE) prefixcheck
|
||||
for cat in $(MOFILES) $(MOCONVERTED); do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
|
||||
done
|
||||
|
||||
converted: $(MOCONVERTED)
|
||||
|
||||
# nl.po was added later, if it does not exist use a file with just a # in it
|
||||
# (an empty file doesn't work with old msgfmt).
|
||||
nl.po:
|
||||
@( echo \# > nl.po )
|
||||
|
||||
# Norwegian/Bokmal: "nb" is an alias for "no".
|
||||
# Copying the file is not efficient, but I don't know of another way to make
|
||||
# this work.
|
||||
nb.po: no.po
|
||||
cp no.po nb.po
|
||||
|
||||
# Convert ja.po to create ja.sjis.po. Requires doubling backslashes in the
|
||||
# second byte. Don't depend on sjiscorr, it should only be compiled when
|
||||
# ja.sjis.po is outdated.
|
||||
ja.sjis.po: ja.po
|
||||
@$(MAKE) sjiscorr
|
||||
rm -f ja.sjis.po
|
||||
iconv -f utf-8 -t cp932 ja.po | ./sjiscorr > ja.sjis.po
|
||||
|
||||
sjiscorr: sjiscorr.c
|
||||
$(CC) -o sjiscorr sjiscorr.c
|
||||
|
||||
ja.euc-jp.po: ja.po
|
||||
iconv -f utf-8 -t euc-jp ja.po | \
|
||||
$(SAFE_SED) -e 's/charset=utf-8/charset=euc-jp/' -e 's/# Original translations/# Generated from ja.po, DO NOT EDIT/' > ja.euc-jp.po
|
||||
|
||||
# Convert cs.po to create cs.cp1250.po.
|
||||
cs.cp1250.po: cs.po
|
||||
rm -f cs.cp1250.po
|
||||
iconv -f iso-8859-2 -t cp1250 cs.po | \
|
||||
$(SAFE_SED) -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from cs.po, DO NOT EDIT/' > cs.cp1250.po
|
||||
|
||||
# Convert pl.po to create pl.cp1250.po.
|
||||
pl.cp1250.po: pl.po
|
||||
rm -f pl.cp1250.po
|
||||
iconv -f iso-8859-2 -t cp1250 pl.po | \
|
||||
$(SAFE_SED) -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' > pl.cp1250.po
|
||||
|
||||
# Convert pl.po to create pl.UTF-8.po.
|
||||
pl.UTF-8.po: pl.po
|
||||
rm -f pl.UTF-8.po
|
||||
iconv -f iso-8859-2 -t utf-8 pl.po | \
|
||||
$(SAFE_SED) -e 's/charset=ISO-8859-2/charset=utf-8/' -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' > pl.UTF-8.po
|
||||
|
||||
# Convert sk.po to create sk.cp1250.po.
|
||||
sk.cp1250.po: sk.po
|
||||
rm -f sk.cp1250.po
|
||||
iconv -f iso-8859-2 -t cp1250 sk.po | \
|
||||
$(SAFE_SED) -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from sk.po, DO NOT EDIT/' > sk.cp1250.po
|
||||
|
||||
# Convert zh_CN.po to create zh_CN.cp936.po.
|
||||
# set 'charset' to gbk to avoid that msfmt generates a warning
|
||||
zh_CN.cp936.po: zh_CN.po
|
||||
rm -f zh_CN.cp936.po
|
||||
iconv -f gb2312 -t cp936 zh_CN.po | \
|
||||
$(SAFE_SED) -e 's/charset=gb2312/charset=gbk/' -e 's/# Original translations/# Generated from zh_CN.po, DO NOT EDIT/' > zh_CN.cp936.po
|
||||
|
||||
# Convert ko.UTF-8.po to create ko.po.
|
||||
ko.po: ko.UTF-8.po
|
||||
rm -f ko.po
|
||||
iconv -f UTF-8 -t euc-kr ko.UTF-8.po | \
|
||||
$(SAFE_SED) -e 's/charset=UTF-8/charset=euc-kr/' \
|
||||
-e 's/# Korean translation for Vim/# Generated from ko.UTF-8.po, DO NOT EDIT/' \
|
||||
> ko.po
|
||||
|
||||
# Convert ru.po to create ru.cp1251.po.
|
||||
ru.cp1251.po: ru.po
|
||||
rm -f ru.cp1251.po
|
||||
iconv -f utf-8 -t cp1251 ru.po | \
|
||||
$(SAFE_SED) -e 's/charset=utf-8/charset=cp1251/' -e 's/# Original translations/# Generated from ru.po, DO NOT EDIT/' > ru.cp1251.po
|
||||
|
||||
# Convert uk.po to create uk.cp1251.po.
|
||||
uk.cp1251.po: uk.po
|
||||
rm -f uk.cp1251.po
|
||||
iconv -f utf-8 -t cp1251 uk.po | \
|
||||
$(SAFE_SED) -e 's/charset=utf-8/charset=cp1251/' -e 's/# Original translations/# Generated from uk.po, DO NOT EDIT/' > uk.cp1251.po
|
||||
|
||||
prefixcheck:
|
||||
@if test "x" = "x$(prefix)"; then \
|
||||
echo "******************************************"; \
|
||||
echo " please use make from the src directory "; \
|
||||
echo "******************************************"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
clean: checkclean
|
||||
rm -f core core.* *.old.po *.mo *.pot sjiscorr
|
||||
|
||||
distclean: clean
|
||||
|
||||
checkclean:
|
||||
rm -f *.ck
|
||||
|
||||
$(PACKAGE).pot: $(SOURCE_FILES)
|
||||
$(XGETTEXT) --default-domain=$(PACKAGE) \
|
||||
--add-comments --keyword=_ --keyword=N_ \
|
||||
$(SOURCE_FILES)
|
||||
mv $(PACKAGE).po $(PACKAGE).pot
|
||||
|
||||
update-po: $(LANGUAGES)
|
||||
|
||||
# Don't add a dependency here, we only want to update the .po files manually
|
||||
$(LANGUAGES):
|
||||
@$(MAKE) $(PACKAGE).pot
|
||||
if test ! -f $@.po.orig; then cp $@.po $@.po.orig; fi
|
||||
mv $@.po $@.po.old
|
||||
if $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po; then \
|
||||
rm -f $@.po.old; \
|
||||
else \
|
||||
echo "msgmerge for $@.po failed!"; mv $@.po.old $@.po; \
|
||||
fi
|
@ -2,6 +2,8 @@
|
||||
#
|
||||
# FIRST AUTHOR SungHyun Nam <goweol@gmail.com>, 2000-2011
|
||||
#
|
||||
# Original translations.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vim 7.3\n"
|
||||
|
@ -1,7 +1,9 @@
|
||||
# Generated from ko.UTF-8.po, DO NOT EDIT
|
||||
# Korean translation for Vim
|
||||
#
|
||||
# FIRST AUTHOR SungHyun Nam <goweol@gmail.com>, 2000-2011
|
||||
#
|
||||
# Generated from ko.UTF-8, DO NOT EDIT.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vim 7.3\n"
|
||||
|
Loading…
Reference in New Issue
Block a user