Update TDEL10n module – add processing of tips #5

Samengevoegd
SlavekB heeft 1 commits samengevoegd van feat/CMakeL10n-tips naar master 5 jaren geleden
Eigenaar

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 beoordeeld 5 jaren geleden
MicheleC heeft een reactie achtergelaten
Eigenaar

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

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
Eigenaar

PR #4

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

PR #4

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

PR #4

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

PR #4

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

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
Eigenaar

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?
Eigenaar

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
Eigenaar

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

looks good to me 👍

looks good to me :+1:
SlavekB heeft deze pull request gesloten 5 jaren geleden
SlavekB heeft 5 jaren geleden de branch feat/CMakeL10n-tips verwijderd.
SlavekB heeft dit 5 jaren geleden aan de mijlpaal R14.0.6 release toegevoegd
De pull request is samengevoegd als dcb28a87ae.
Log in om deel te nemen aan deze discussie.
Geen beoordelaars
Geen mijlpaal
Niet toegewezen
2 deelnemers
Notificaties
Vervaldatum

Geen vervaldatum ingesteld.

Afhankelijkheden

Geen afhankelijkheden ingesteld.

Referentie: TDE/tde-cmake#5
Laden…
Er is nog geen inhoud.