Skip to content

Commit

Permalink
Merge PR #323 - 'translation-zh' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
fellen committed Aug 20, 2023
2 parents 382fb2b + a4f9747 commit 35ac390
Show file tree
Hide file tree
Showing 257 changed files with 24,072 additions and 25 deletions.
4 changes: 3 additions & 1 deletion C/guide/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,6 @@ set (figures
figures/txns_sxn_ledger4.png
)

add_gnc_doc_targets(${lang} "${entities}" "${figures}")
set (xslt_files "")

add_gnc_doc_targets(${lang} "${entities}" "${figures}" "${xslt_files}")
4 changes: 3 additions & 1 deletion C/manual/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ set (figures
figures/window-tip.png
)

add_gnc_doc_targets(${lang} "${entities}" "${figures}")
set (xslt_files "")

add_gnc_doc_targets(${lang} "${entities}" "${figures}" "${xslt_files}")
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ set(JAPANESE_MINCHO_TTF "ume-tmo3.ttf" CACHE STRING "Mincho TrueType font used f
set(JAPANESE_GOTHIC_TTF "ume-tmo3.ttf" CACHE STRING "Gothic TrueType font used for Japanese pdf")
set(japanese_fontdir "${CMAKE_SOURCE_DIR}/fonts/truetype" CACHE STRING "Directory to search for Japanese fonts")

# Set the default XSL file path
set(BASE_XSLT_HTML "${CMAKE_SOURCE_DIR}/xsl/general-customization.xsl")
set(BASE_XSLT_PDF "${CMAKE_SOURCE_DIR}/xsl/general-fo-customization.xsl")
set(BASE_XSLT_EPUB "${CMAKE_SOURCE_DIR}/xsl/general-epub-customization.xsl")
set(BASE_XSLT_CHM "${CMAKE_SOURCE_DIR}/xsl/general-chm-customization.xsl")

# Buildtime destination directories for our generated documentation
set(DATADIR_BUILD "${CMAKE_BINARY_DIR}/share")
set(DOCDIR_BUILD "${DATADIR_BUILD}/doc/${PACKAGE}")
Expand Down Expand Up @@ -182,6 +188,7 @@ add_subdirectory (it)
add_subdirectory (ja)
add_subdirectory (pt)
#add_subdirectory (ru)
add_subdirectory (zh)

file(GLOB_RECURSE extrafiles
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
7 changes: 6 additions & 1 deletion cmake/AddChmTarget.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function (add_chm_target targetbase lang entities figures)
function (add_chm_target targetbase lang entities figures xslt_file)

set(docname "gnucash-${targetbase}")
set(chmfile "${docname}.chm")
Expand All @@ -7,6 +7,10 @@ function (add_chm_target targetbase lang entities figures)
set(BUILD_DIR "${DOCDIR_BUILD}/${lang}")
file(MAKE_DIRECTORY "${BUILD_DIR}")

if (NOT IS_ABSOLUTE ${xslt_file})
set(xslt_file "${CMAKE_CURRENT_SOURCE_DIR}/${xslt_file}")
endif()

file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/htmlhelp")
add_custom_command(
OUTPUT "${BUILD_DIR}/${chmfile}" "${BUILD_DIR}/${mapfile}"
Expand All @@ -18,6 +22,7 @@ function (add_chm_target targetbase lang entities figures)
-D BUILD_DIR=${BUILD_DIR}
-D XSLTPROC=${XSLTPROC}
"-DXSLTPROCFLAGS=\"${XSLTPROCFLAGS}\""
"-Dxslfiles=\"${xslt_file}\""
"-Dentities=\"${entities}\""
-D HHC=${HHC}
-P ${CMAKE_SOURCE_DIR}/cmake/MakeChm.cmake
Expand Down
8 changes: 6 additions & 2 deletions cmake/AddEpubTarget.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
function (add_epub_target targetbase lang entities figures)
function (add_epub_target targetbase lang entities figures xslt_file)

set(docname "gnucash-${targetbase}")
set(epubfile "${docname}.epub")
set(EPUB_TMPDIR "${CMAKE_CURRENT_BINARY_DIR}/epub")

set(BUILD_DIR "${DOCDIR_BUILD}/${lang}")

if (NOT IS_ABSOLUTE ${xslt_file})
set(xslt_file "${CMAKE_CURRENT_SOURCE_DIR}/${xslt_file}")
endif()

add_custom_command(
OUTPUT "${BUILD_DIR}/${epubfile}"
COMMAND rm -fr "${EPUB_TMPDIR}"
Expand All @@ -17,7 +21,7 @@ function (add_epub_target targetbase lang entities figures)
--stringparam epub.metainf.dir META-INF/
--stringparam epub.oebps.dir OEBPS/
--stringparam fop1.extensions 1
"${CMAKE_SOURCE_DIR}/xsl/1.79.2/epub/docbook.xsl"
"${xslt_file}"
"${CMAKE_CURRENT_SOURCE_DIR}/index.docbook"
COMMAND cmake -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/figures" "${EPUB_TMPDIR}/OEBPS/figures"
COMMAND ${CMAKE_COMMAND} -E make_directory "${BUILD_DIR}"
Expand Down
36 changes: 30 additions & 6 deletions cmake/AddGncDocTargets.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function (add_gnc_doc_targets lang entities figures)
function (add_gnc_doc_targets lang entities figures xslt_files)

get_filename_component(targetbase ${CMAKE_CURRENT_SOURCE_DIR} NAME)
set(docname "gnucash-${targetbase}")
Expand All @@ -22,21 +22,44 @@ function (add_gnc_doc_targets lang entities figures)
add_dependencies(${lang}-check "${lang}-${targetbase}-check")
endif()

# Parse and assign XSLT file path for each document format
set(xslt_html "${BASE_XSLT_HTML}")
set(xslt_pdf "${BASE_XSLT_PDF}")
set(xslt_epub "${BASE_XSLT_EPUB}")
set(xslt_chm "${BASE_XSLT_CHM}")
set(xslt_filename_list "")
while(NOT "${xslt_files}" STREQUAL "")
list(POP_FRONT xslt_files xslt_docfmt xslt_filename)
list(APPEND xslt_filename_list ${xslt_filename})
if(xslt_docfmt STREQUAL "html")
set(xslt_html ${xslt_filename})
endif()
if(xslt_docfmt STREQUAL "pdf")
set(xslt_pdf ${xslt_filename})
endif()
if(xslt_docfmt STREQUAL "epub")
set(xslt_epub ${xslt_filename})
endif()
if(xslt_docfmt STREQUAL "chm")
set(xslt_chm ${xslt_filename})
endif()
endwhile()

# Add targets for each document format that is enabled
if (WITH_CHM)
add_chm_target(${targetbase} ${lang} "${entities}" "${figures}")
add_chm_target(${targetbase} ${lang} "${entities}" "${figures}" "${xslt_chm}")
endif()
if (WITH_XDGHELP)
add_xdghelp_target(${targetbase} ${lang} "${entities}" "${figures}")
endif()
if (WITH_HTML)
add_html_target(${targetbase} ${lang} "${entities}" "${figures}")
add_html_target(${targetbase} ${lang} "${entities}" "${figures}" "${xslt_html}")
endif()
if (WITH_PDF)
add_pdf_target(${targetbase} ${lang} "${entities}" "${figures}")
add_pdf_target(${targetbase} ${lang} "${entities}" "${figures}" "${xslt_pdf}")
endif()
if (WITH_EPUB)
add_epub_target(${targetbase} ${lang} "${entities}" "${figures}")
add_epub_target(${targetbase} ${lang} "${entities}" "${figures}" "${xslt_epub}")
endif()
if (WITH_MOBI)
add_mobi_target(${targetbase} ${lang})
Expand All @@ -46,6 +69,7 @@ function (add_gnc_doc_targets lang entities figures)
CMakeLists.txt
index.docbook
${entities}
${figures})
${figures}
${xslt_filename_list})

endfunction()
7 changes: 5 additions & 2 deletions cmake/AddHtmlTarget.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
# - entities: list of all xml files this document is composed of
# - figdir: name of the directory holding the images

function (add_html_target targetbase lang entities figures)
function (add_html_target targetbase lang entities figures xslt_file)

set(docname "gnucash-${targetbase}")
set(styledir "${CMAKE_SOURCE_DIR}/stylesheet")
file(GLOB styleicons "${CMAKE_SOURCE_DIR}/stylesheet/*.png")
set(BUILD_DIR "${DOCDIR_BUILD}/${lang}/${docname}")

if (NOT IS_ABSOLUTE ${xslt_file})
set(xslt_file "${CMAKE_CURRENT_SOURCE_DIR}/${xslt_file}")
endif()

# Convert xml to html with xsltproc
# xsltproc --xinclude -o outputdir/ /usr/share/sgml/docbook/xsl-stylesheets/html/chunk.xsl filename.xml
Expand All @@ -27,7 +30,7 @@ function (add_html_target targetbase lang entities figures)
-o "${BUILD_DIR}/"
--param use.id.as.filename "1"
--stringparam chunker.output.encoding UTF-8
"${CMAKE_SOURCE_DIR}/xsl/general-customization.xsl"
"${xslt_file}"
"${CMAKE_CURRENT_SOURCE_DIR}/index.docbook"
COMMAND touch "${CMAKE_CURRENT_BINARY_DIR}/htmltrigger"
DEPENDS ${entities} "index.docbook" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd")
Expand Down
8 changes: 6 additions & 2 deletions cmake/AddPdfTarget.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function (add_pdf_target targetbase lang entities figures)
function (add_pdf_target targetbase lang entities figures xslt_file)

set(docname "gnucash-${targetbase}")
set(fofile "${docname}.fo")
Expand All @@ -19,6 +19,10 @@ function (add_pdf_target targetbase lang entities figures)
endif()
endif()

if (NOT IS_ABSOLUTE ${xslt_file})
set(xslt_file "${CMAKE_CURRENT_SOURCE_DIR}/${xslt_file}")
endif()

add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${fofile}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${BUILD_DIR}"
Expand All @@ -27,7 +31,7 @@ function (add_pdf_target targetbase lang entities figures)
--stringparam fop1.extensions 1
--stringparam variablelist.as.blocks 1
--stringparam glosslist.as.blocks 1
"${CMAKE_SOURCE_DIR}/xsl/1.79.2/fo/docbook.xsl"
"${xslt_file}"
"${CMAKE_CURRENT_SOURCE_DIR}/index.docbook"
DEPENDS ${entities} "index.docbook" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd")

Expand Down
7 changes: 6 additions & 1 deletion cmake/DistCommon.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
function(add_to_dist)
set(local_dist_files ${dist_files})
foreach(file ${ARGN})
file(RELATIVE_PATH relative ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${file})
if (IS_ABSOLUTE ${file})
set(fullpath ${file})
else()
set(fullpath ${CMAKE_CURRENT_SOURCE_DIR}/${file})
endif()
file(RELATIVE_PATH relative ${CMAKE_SOURCE_DIR} ${fullpath})
list(APPEND local_dist_files ${relative})
endforeach()
set (dist_files ${local_dist_files}
Expand Down
2 changes: 1 addition & 1 deletion cmake/MakeChm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ execute_process(
# FIXME Reusing ${XSLTPROCFLAGS} fails as xsltproc gets this as one single parameter instead of 3...
COMMAND ${XSLTPROC} --path "${SRC_DIR}/docbook" --xinclude
--stringparam htmlhelp.chm ${chmfile}
"${SRC_DIR}/xsl/1.79.2/htmlhelp/htmlhelp.xsl"
"${xslfiles}"
"${CURRENT_SRC_DIR}/index.docbook"
WORKING_DIRECTORY "${htmlhelpdir}")

Expand Down
4 changes: 3 additions & 1 deletion de/guide/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,6 @@ set (figures

)

add_gnc_doc_targets(${lang} "${entities}" "${figures}")
set (xslt_files "")

add_gnc_doc_targets(${lang} "${entities}" "${figures}" "${xslt_files}")
4 changes: 3 additions & 1 deletion de/manual/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,6 @@ set (figures
figures/window-main-empty.png
)

add_gnc_doc_targets(${lang} "${entities}" "${figures}")
set (xslt_files "")

add_gnc_doc_targets(${lang} "${entities}" "${figures}" "${xslt_files}")
9 changes: 9 additions & 0 deletions docbook/gnc-gui-zh.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- Add translated entities below. The master entities are in gnc-gui-C.dtd.
Only parameter entities (% entities) should be translated.
See htps://www.w3.org/TR/REC-xml/#sec-physical-struct. -->

<!-- Include "gnc-gui-C.dtd" -->
<!ENTITY % gnc-gui-C SYSTEM "gnc-gui-C.dtd">
%gnc-gui-C;

<!-- Don't add any declarations below. -->
Binary file added fonts/opentype/source/SourceHanSansCN-Bold.otf
Binary file not shown.
Binary file added fonts/opentype/source/SourceHanSansCN-Regular.otf
Binary file not shown.
Binary file added fonts/opentype/source/SourceHanSerifCN-Bold.otf
Binary file not shown.
Binary file not shown.
Binary file added fonts/truetype/Arphic/ukai.ttc
Binary file not shown.
4 changes: 3 additions & 1 deletion it/guide/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ set (figures
# xml2po -e -p ${srcdir}/it.po -o $@ ${top_srcdir}/guide/C/index.docbook
# if test "${srcdir}" != "${builddir}"; then mv $@ ${srcdir}; fi

add_gnc_doc_targets(${lang} "" "${figures}")
set (xslt_files "")

add_gnc_doc_targets(${lang} "" "${figures}" "${xslt_files}")

set(extra_dist
COME-TRADURRE
Expand Down
4 changes: 3 additions & 1 deletion it/manual/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ set (figures
# xml2po -e -p ${srcdir}/it.po -o $@ ${CMAKE_SOURCE_DIR}/manual/C/index.docbook
# if test "${srcdir}" != "${builddir}"; then mv $@ ${srcdir}; fi

add_gnc_doc_targets(${lang} "" "${figures}")
set (xslt_files "")

add_gnc_doc_targets(${lang} "" "${figures}" "${xslt_files}")

set(extra_dist
COME-TRADURRE
Expand Down
4 changes: 3 additions & 1 deletion ja/guide/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,11 @@ set (figures
figures/txns_sxn_ledger4.png
)

set (xslt_files "")

set (FOP_XCONF "${CMAKE_CURRENT_SOURCE_DIR}/fop.xconf.in")

add_gnc_doc_targets(${lang} "${entities}" "${figures}")
add_gnc_doc_targets(${lang} "${entities}" "${figures}" "${xslt_files}")

set(extra_dist
fop.xconf.in)
Expand Down
4 changes: 3 additions & 1 deletion pt/guide/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,6 @@ set (figures
figures/txns_sxn_ledger4.png
)

add_gnc_doc_targets(${lang} "${entities}" "${figures}")
set (xslt_files "")

add_gnc_doc_targets(${lang} "${entities}" "${figures}" "${xslt_files}")
4 changes: 3 additions & 1 deletion pt/manual/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ set (figures
figures/icons/split_transaction.png
)

add_gnc_doc_targets(${lang} "${entities}" "${figures}")
set (xslt_files "")

add_gnc_doc_targets(${lang} "${entities}" "${figures}" "${xslt_files}")
4 changes: 3 additions & 1 deletion ru/guide/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,11 @@ set (figures
figures/txns_sxn_ledger4.png
)

set (xslt_files "")

set (FOP_XCONF "${CMAKE_CURRENT_SOURCE_DIR}/fop.xconf.in")

add_gnc_doc_targets(${lang} "${entities}" "${figures}")
add_gnc_doc_targets(${lang} "${entities}" "${figures}" "${xslt_files}")

set(extra_dist
fop.xconf.in)
Expand Down
13 changes: 13 additions & 0 deletions xsl/general-chm-customization.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'
xmlns="http://www.w3.org/TR/xhtml1/transitional"
exclude-result-prefixes="#default">

<!--########################Files to Include######################-->

<!-- Importing the Norman Walsh's stylesheet as the basis. -->
<xsl:import href="1.79.2/htmlhelp/htmlhelp.xsl"/>
<!-- see NOTE ABOUT PATHS in README file for details -->

</xsl:stylesheet>
13 changes: 13 additions & 0 deletions xsl/general-epub-customization.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'
xmlns="http://www.w3.org/TR/xhtml1/transitional"
exclude-result-prefixes="#default">

<!--########################Files to Include######################-->

<!-- Importing the Norman Walsh's stylesheet as the basis. -->
<xsl:import href="1.79.2/epub/docbook.xsl"/>
<!-- see NOTE ABOUT PATHS in README file for details -->

</xsl:stylesheet>
13 changes: 13 additions & 0 deletions xsl/general-fo-customization.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'
xmlns="http://www.w3.org/TR/xhtml1/transitional"
exclude-result-prefixes="#default">

<!--########################Files to Include######################-->

<!-- Importing the Norman Walsh's stylesheet as the basis. -->
<xsl:import href="1.79.2/fo/docbook.xsl"/>
<!-- see NOTE ABOUT PATHS in README file for details -->

</xsl:stylesheet>
5 changes: 5 additions & 0 deletions zh/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
add_lang_targets("zh")

add_subdirectory(guide)

add_to_dist(CMakeLists.txt)
Loading

0 comments on commit 35ac390

Please sign in to comment.