[Ktutorial-commits] SF.net SVN: ktutorial:[251] trunk/ktutorial/ktutorial-editor/doc
Status: Alpha
Brought to you by:
danxuliu
From: <dan...@us...> - 2010-09-21 16:24:20
|
Revision: 251 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=251&view=rev Author: danxuliu Date: 2010-09-21 16:24:13 +0000 (Tue, 21 Sep 2010) Log Message: ----------- Fix handbook localization: the "English" entity in the base Docbook files must be changed to the language of the localization. If this is not done, the common KDE entities will be replaced with their English value instead of their localized value. Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/doc/CMakeLists.txt Added Paths: ----------- trunk/ktutorial/ktutorial-editor/doc/es/language Modified: trunk/ktutorial/ktutorial-editor/doc/CMakeLists.txt =================================================================== --- trunk/ktutorial/ktutorial-editor/doc/CMakeLists.txt 2010-09-20 19:30:21 UTC (rev 250) +++ trunk/ktutorial/ktutorial-editor/doc/CMakeLists.txt 2010-09-21 16:24:13 UTC (rev 251) @@ -9,6 +9,15 @@ ------") else(NOT PO2XML_EXECUTABLE) + find_program(SED_EXECUTABLE sed) + + if(NOT SED_EXECUTABLE) + message( +"------ + NOTE: sed not found. Common KDE text in handbooks will *not* be translated +------") + endif(NOT SED_EXECUTABLE) + file(GLOB_RECURSE PO_FILES ktutorial-editor-handbook.po) file(GLOB DOCBOOK_FILES en/*.docbook) @@ -23,24 +32,45 @@ # directory foreach(docbookFile ${DOCBOOK_FILES}) get_filename_component(docbookFileName ${docbookFile} NAME) - set(translatedDocbookFile ${CMAKE_CURRENT_SOURCE_DIR}/${lang}/${docbookFileName}) + set(langDirectory ${CMAKE_CURRENT_SOURCE_DIR}/${lang}) + set(translatedDocbookFile ${langDirectory}/${docbookFileName}) list(APPEND allTranslatedDocbookFiles ${translatedDocbookFile}) set(po2XmlCommand ${PO2XML_EXECUTABLE} ${docbookFile} ${poFile}) - add_custom_command(OUTPUT ${translatedDocbookFile} - COMMAND ${po2XmlCommand} > ${translatedDocbookFile} - DEPENDS ${docbookFile} ${poFile}) + # kde4_create_handbook gets a list of the docbook files that had to + # be copied when the handbook is installed. The custom commands + # below create the translation for each file in order to be found by + # the kde4_create_handbook macro. Also, the translations will be + # updated as needed by the build system if the docbook or the po + # file were modified. + # Note, however, that the translations are created/updated under the + # source directory, not the build directory, as there is where + # kde4_create_handbook expects them. + if(NOT SED_EXECUTABLE) + add_custom_command(OUTPUT ${translatedDocbookFile} + COMMAND ${po2XmlCommand} > ${translatedDocbookFile} + DEPENDS ${docbookFile} ${poFile}) + else(NOT SED_EXECUTABLE) - # kde4_create_handbook gets a list of the docbook files that had to - # be copied when the handbook is installed. It creates, when the - # configuration previous to the build is made, the translation for - # each file in order to be found by the macro. - # It does not interfere with the normmal behavior of the build - # system. The translations will be updated as needed when the - # docbook or the po file are modified. - execute_process(COMMAND ${po2XmlCommand} - OUTPUT_FILE ${translatedDocbookFile}) + # sed is used to set the entity containing the name of the + # language to its appropriate value in each translated + # index.docbook file. + # If this is not done, the rest of the entities appear in + # English instead of in the language of the translation. + # The name of the language is read from the language file in + # each localization directory. + file(READ ${langDirectory}/language langName) + set(sedCommand ${SED_EXECUTABLE} + "-e \"s/<!ENTITY % English/<!ENTITY % ${langName}/\"" + -i ${translatedDocbookFile} + ) + + add_custom_command(OUTPUT ${translatedDocbookFile} + COMMAND ${po2XmlCommand} > ${translatedDocbookFile} + COMMAND ${sedCommand} + DEPENDS ${docbookFile} ${poFile}) + endif(NOT SED_EXECUTABLE) endforeach(docbookFile ${DOCBOOK_FILES}) endforeach(poFile ${PO_FILES}) Added: trunk/ktutorial/ktutorial-editor/doc/es/language =================================================================== --- trunk/ktutorial/ktutorial-editor/doc/es/language (rev 0) +++ trunk/ktutorial/ktutorial-editor/doc/es/language 2010-09-21 16:24:13 UTC (rev 251) @@ -0,0 +1 @@ +Spanish \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |