Difference between revisions of "Cherry Picker"

From Lingoport Wiki
Jump to: navigation, search
(Example 1-sending subset of all files for a locale)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
  +
= Cherry Picker =
 
The idea behind the cherry picker is that you can ''ignore'' file(s) (not keys) for specific locales or ''include'' files for specific locales.
 
The idea behind the cherry picker is that you can ''ignore'' file(s) (not keys) for specific locales or ''include'' files for specific locales.
   
Line 10: Line 11:
 
* The cherry picking is done per locale
 
* The cherry picking is done per locale
   
== Example 1 ==
+
== Example 1-sending subset of all files for a locale ==
 
For instance, let's say that you want to send 9 files out of 10 to translate into French and German and all ten for the remaining locales. You could write a Cherry Picker like:
 
For instance, let's say that you want to send 9 files out of 10 to translate into French and German and all ten for the remaining locales. You could write a Cherry Picker like:
 
<pre>
 
<pre>
Line 34: Line 35:
 
<locale code="fr">
 
<locale code="fr">
 
<files-include>
 
<files-include>
<include file="/locales/file1_de.json"/>
+
<include file="/locales/file1_fr.json"/>
<include file="/locales/file2_de.json"/>
+
<include file="/locales/file2_fr.json"/>
<include file="/locales/file3_de.json"/>
+
<include file="/locales/file3_fr.json"/>
<include file="/locales/file4_de.json"/>
+
<include file="/locales/file4_fr.json"/>
<include file="/locales/file5_de.json"/>
+
<include file="/locales/file5_fr.json"/>
<include file="/locales/file6_de.json"/>
+
<include file="/locales/file6_fr.json"/>
<include file="/locales/file7_de.json"/>
+
<include file="/locales/file7_fr.json"/>
<include file="/locales/file8_de.json"/>
+
<include file="/locales/file8_fr.json"/>
<include file="/locales/file9_de.json"/>
+
<include file="/locales/file9_fr.json"/>
 
</files-include>
 
</files-include>
 
</locale>
 
</locale>
Line 51: Line 52:
 
</pre>
 
</pre>
   
In this example, if the <code>locales</code> directory has 10 files, only 9 are sent for French and German; The other locales in this LRM project are not affected.
+
In this example, if the <code>locales</code> directory has 10 files, only 9 are sent for French and German; The other locales in this LRM project are not affected.
   
== Example 2 ==
+
== Example 2-preventing files from being prepped for a locale ==
 
Now let's say that for Chinese you do not want to send any files. You could write a Cherry Picker like:
 
Now let's say that for Chinese you do not want to send any files. You could write a Cherry Picker like:
 
<pre>
 
<pre>

Latest revision as of 22:38, 8 May 2019

Cherry Picker

The idea behind the cherry picker is that you can ignore file(s) (not keys) for specific locales or include files for specific locales.

This feature sometimes lead to misunderstanding so use it with care and remember to edit/remove/rename the cherry picker file when done cherry picking!

The mechanics:

  • Create a file under the project configuration directory (<HOME>/Lingoport_Data/L10nStreamlining/GroupName/projects/ProjectName/config) named config_file_cherry_picker.xml. There is a template in <HOME>/Lingoport_Data/L10nStreamlining/config
  • Edit that file to say what file to include for what locale in the next prep kit. If you have a 'fake' file, no files will be sent for that locale.
  • The locale code must match one of your target locales
  • The cherry picking is done per locale

Example 1-sending subset of all files for a locale

For instance, let's say that you want to send 9 files out of 10 to translate into French and German and all ten for the remaining locales. You could write a Cherry Picker like:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<file-cherry-picker>
<locales>

<!-- Send 9 files out of 10 for German & French -->
	<locale code="de">
		<files-include>
			<include file="/locales/file1_de.json"/>
			<include file="/locales/file2_de.json"/>
			<include file="/locales/file3_de.json"/>
			<include file="/locales/file4_de.json"/>
			<include file="/locales/file5_de.json"/>
			<include file="/locales/file6_de.json"/>
			<include file="/locales/file7_de.json"/>
			<include file="/locales/file8_de.json"/>
			<include file="/locales/file9_de.json"/>
		</files-include>
	</locale>

	<locale code="fr">
		<files-include>
			<include file="/locales/file1_fr.json"/>
			<include file="/locales/file2_fr.json"/>
			<include file="/locales/file3_fr.json"/>
			<include file="/locales/file4_fr.json"/>
			<include file="/locales/file5_fr.json"/>
			<include file="/locales/file6_fr.json"/>
			<include file="/locales/file7_fr.json"/>
			<include file="/locales/file8_fr.json"/>
			<include file="/locales/file9_fr.json"/>
		</files-include>
	</locale>


</locales>
</file-cherry-picker>

In this example, if the locales directory has 10 files, only 9 are sent for French and German; The other locales in this LRM project are not affected.

Example 2-preventing files from being prepped for a locale

Now let's say that for Chinese you do not want to send any files. You could write a Cherry Picker like:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<file-cherry-picker>
<locales>

<!-- Put Simplified Chinese on hold -->
	<locale code="zh-Hans">
		<files-include>
			<include file="/locales/fake_zh-Hans.json"/>
		</files-include>
	</locale>

</locales>
</file-cherry-picker>

In this example, the cherry picker is set for the zh-Hans locale. It states that for that locale, the file to be included is a fake file, fake_zh_Hans.json. Since that file does not exist, no files will be sent for translation. Sending resource bundles for the other locales in the LRM project are not affected.


You can have as many locales as you want and include as many files as you want. When the files are ready to be prepped (for whatever reason), you can rename/delete that file and all the files for all locales will be back on the prep kit train.

Don't forget to remove or rename this file once you are done with cherry picking.