Update TDEL10n module – add processing of tips #5

Merged
SlavekB merged 1 commits from feat/CMakeL10n-tips into master 5 years ago
Owner

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. The tde_l10n_preparetips macro replaces the external tdelibs/tdeui/preparetips script.

Note: Instead of using file( STRINGS ... ) and then processing lines using list( GET ... ), file( READ ... ) is used and individual lines are retrieved using string( REGEX REPLACE ... ). Usage file( STRINGS ) was not reliable for tips files.

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. The `tde_l10n_preparetips` macro replaces the external [`tdelibs/tdeui/preparetips`](../tdelibs/src/branch/master/tdeui/preparetips) script. Note: Instead of using `file( STRINGS ... )` and then processing lines using `list( GET ... )`, `file( READ ... )` is used and individual lines are retrieved using `string( REGEX REPLACE ... )`. Usage `file( STRINGS )` was not reliable for tips files.
MicheleC reviewed 5 years ago
MicheleC left a comment
Owner

need to remore code of PR #4 from this PR. Also to discuss about rename operation

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]]
Owner

This relates to PR #4, together with other sections for EXCLUDES. Should not be in this commit, IMO

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
Owner

PR #4

PR #4
unset( _catalog )
unset( _sources )
unset( _excludes )
Owner

PR #4

PR #4
set( _directive 1 )
endif( )
# found directive "EXCLUDES"
Owner

PR #4

PR #4
endif( )
endforeach( )
if( _excludes )
Owner

PR #4

PR #4
cmake_policy( SET CMP0007 NEW )
endif( POLICY CMP0007 )
if( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_tips}.orig )
Owner

what happens if process somewhere in between this rename and later rename back to original name?

example:

rename pippotip -> pippotip.orig
...
process fail, aborted
....
!!! rename pippotip.orig -> pippotip is not executed.

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)

what happens if process somewhere in between this rename and later rename back to original name? example: ``` rename pippotip -> pippotip.orig ... process fail, aborted .... !!! rename pippotip.orig -> pippotip is not executed. ``` 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)
Poster
Owner

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:

  1. 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.

  2. Make edits to copies of files, use these copies for xgettext and leave location information in POT files not too useful for translators.

  3. 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?

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: 1. 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. 2. Make edits to copies of files, use these copies for xgettext and leave location information in POT files not too useful for translators. 3. 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?
Owner

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.

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.
Poster
Owner

Processing of "tips" files now uses the ability to avoid editing the original source file.

Processing of "tips" files now uses the ability to avoid editing the original source file.
Owner

looks good to me 👍

looks good to me :+1:
SlavekB closed this pull request 5 years ago
SlavekB deleted branch feat/CMakeL10n-tips 5 years ago
SlavekB added this to the R14.0.6 release milestone 5 years ago
The pull request has been merged as dcb28a87ae.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: TDE/tde-cmake#5
Loading…
There is no content yet.