#5 Update TDEL10n module – add processing of tips

Merged
SlavekB merged 2 commits from feat/CMakeL10n-tips into master 5 months ago
SlavekB commented 5 months ago

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 months ago
need to remore code of PR #4 from this PR. Also to discuss about rename operation
@@ -131,6 +131,7 @@ endfunction( )
131 131
 #####   tde_create_l10n_template(
132 132
 #####     CATALOG file_name
133 133
 #####     [SOURCES source_spec [source_spec]]
134
+#####     [EXCLUDES regex [regex]]
MicheleC

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
@@ -148,6 +149,7 @@ endfunction( )
148 149
 #####      - all files with the specified mask will be searched.
149 150
 #####     d) Specify the name of the individual file.
150 151
 #####     The methods from b) to d) can be combined.
152
+#####   EXCLUDES determines which files are to be excluded from processing
MicheleC

PR #4

PR #4
@@ -158,9 +160,11 @@ macro( tde_create_l10n_template )
158 160
 
159 161
   unset( _catalog )
160 162
   unset( _sources )
163
+  unset( _excludes )
MicheleC

PR #4

PR #4
@@ -184,6 +188,13 @@ macro( tde_create_l10n_template )
184 188
       set( _directive 1 )
185 189
     endif( )
186 190
 
191
+    # found directive "EXCLUDES"
MicheleC

PR #4

PR #4
@@ -268,6 +279,16 @@ macro( tde_create_l10n_template )
268 279
     endif( )
269 280
 
270 281
   endforeach( )
282
+  if( _excludes )
MicheleC

PR #4

PR #4
modules/TDEL10n.cmake
@@ -433,0 +488,4 @@
488
+      cmake_policy( SET CMP0007 NEW )
489
+    endif( POLICY CMP0007 )
490
+
491
+    if( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_tips}.orig )
MicheleC

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)
SlavekB

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

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.
SlavekB commented 5 months ago
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.
MicheleC commented 5 months ago
Owner

looks good to me :+1:

looks good to me :+1:
SlavekB deleted branch feat/CMakeL10n-tips 5 months ago
SlavekB added this to the R14.0.6 release milestone 5 months ago
The pull request has been merged.
Sign in to join this conversation.
Loading…
Cancel
Save
There is no content yet.