Update TDEL10n module – add processing of tips #5
Yhdistetty
SlavekB
yhdistetty 1 committia lähteestä feat/CMakeL10n-tips
kohteeseen master
5 vuotta sitten
Ladataan…
Viittaa uudesa ongelmassa
Sisältöä ei vielä ole.
Poista haara 'feat/CMakeL10n-tips'
Deleting a branch is permanent. It CANNOT be undone. Continue?
As part of the source code, the tips can be saved in the
tips
file in HTML format. Tips from such a file can be included in the translation template. Thetde_l10n_preparetips
macro replaces the externaltdelibs/tdeui/preparetips
script.Note: Instead of using
file( STRINGS ... )
and then processing lines usinglist( GET ... )
,file( READ ... )
is used and individual lines are retrieved usingstring( REGEX REPLACE ... )
. Usagefile( STRINGS )
was not reliable for tips files.need to remore code of PR #4 from this PR. Also to discuss about rename operation
##### tde_create_l10n_template(
##### CATALOG file_name
##### [SOURCES source_spec [source_spec]]
##### [EXCLUDES regex [regex]]
This relates to PR #4, together with other sections for EXCLUDES. Should not be in this commit, IMO
##### - all files with the specified mask will be searched.
##### d) Specify the name of the individual file.
##### The methods from b) to d) can be combined.
##### EXCLUDES determines which files are to be excluded from processing
PR #4
unset( _catalog )
unset( _sources )
unset( _excludes )
PR #4
set( _directive 1 )
endif( )
# found directive "EXCLUDES"
PR #4
endif( )
endforeach( )
if( _excludes )
PR #4
cmake_policy( SET CMP0007 NEW )
endif( POLICY CMP0007 )
if( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_tips}.orig )
what happens if process somewhere in between this rename and later rename back to original name?
example:
Here we have dirty repository situation, IMO
Should we consider to first copy the file in pippotip.orig, process it and later copy back overwriting original file? This way if the process is interrupted in the middle, we don't have missing files (just extra .orig file)
xgettext generates location information depending on which file is being processed. Since a large number of files can be processed into one POT file, there is no option to set the mapping temporary name => name for location information in POT file.
Here are three possible solutions:
Make a temporary edits of original files and then restore their original content => that was the way I chose at this time. Of course, this is dangerous if processing fails and the original files are not restored.
Make edits to copies of files, use these copies for xgettext and leave location information in POT files not too useful for translators.
Make edits to copies of files, use these copies for xgettext and then perform a post-processing of location information in POT files.
To make it easy to determine which location information should be post-processed, we can specify an extension to identify such files. For example
.tde_l10n
. In tde_l10n_create_template macro, we could then perform post-processing and cleanup of such work files. The original files would not be affected under any circumstances.What is your opinion on such a solution?
Option 3 is the one that makes more sense, IMO. Option 1 is dangerous as pointed out and option 2 would be not so useful.
Processing of "tips" files now uses the ability to avoid editing the original source file.
looks good to me 👍
dcb28a87ae
.