Update TDEL10n module – add processing of tips #5

Yhdistetty
SlavekB yhdistetty 1 committia lähteestä feat/CMakeL10n-tips kohteeseen master 5 vuotta sitten
Omistaja

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 vuotta sitten
MicheleC jätti kommentin
Omistaja

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

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
Omistaja

PR #4

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

PR #4

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

PR #4

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

PR #4

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

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)
Tekijä
Omistaja

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

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.
Tekijä
Omistaja

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

looks good to me 👍

looks good to me :+1:
SlavekB closed this pull request 5 vuotta sitten
SlavekB poisti haaran feat/CMakeL10n-tips 5 vuotta sitten
SlavekB lisäsi tämän merkkipaaluun R14.0.6 release 5 vuotta sitten
The pull request has been merged as dcb28a87ae.
Sign in to join this conversation.
No reviewers
Ei merkkipaalua
Ei käsittelijää
2 osallistujaa
Ilmoitukset
Määräpäivä

Määräpäivää ei asetettu.

Riippuvuudet

Riippuvuuksia ei asetettu.

Reference: TDE/tde-cmake#5
Ladataan…
Sisältöä ei vielä ole.