-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion: imperial/metric static strings #201
Comments
@slavick Updated XML files (1st pass) are provided with PR #204 for review. In the Existing release <string-array name="food_info_serving_sizes_other_fruits">
<item>%s1 medium-sized fruit</item>
<item>1%s cut-up fruit</item>
<item>%s dried fruit</item>
</string-array>
<string-array name="food_info_serving_sizes_other_fruits_imperial">
<item />
<item> cup</item>
<item>¼ cup</item>
</string-array>
<string-array name="food_info_serving_sizes_other_fruits_metric">
<item />
<item>20 g</item>
<item>40 g</item>
</string-array> Proposed <string-array name="food_info_serving_sizes_other_fruits_imperial">
<item>1 medium-sized fruit</item>
<item>1 cup cut-up fruit</item>
<item>¼ cup dried fruit</item>
</string-array>
<string-array name="food_info_serving_sizes_other_fruits_metric">
<item>1 medium-sized fruit</item>
<item>120 g cut-up fruit</item>
<item>40 g dried fruit</item>
</string-array> |
I like the suggestion and have pushed the code for implementing the change: 830eff3 |
* unified imperial, metric strings (removes need for %s) (#204) see #201 * Implement change to read full serving size strings instead of building them * russian update, escaped quotes, %s simplification (#205) * russian update * xml fixes: `\\'` to `\'`, `\ N` to `\n\n` * escaped double quotes `\"` * fixed "about_text_lines" mapping. also some misc update (fractions) * some Italian updates. French: l\\'application --> l\'application * Update versionCode and versionName * Remove redundant label * Add try/catch for exception that has been observed * Remove unpopular translations * Update strings * Change createWeightsIfDoesNotExist to return boolean (indicating weights saved) instead of the unused Weights object * Remove unused code * Revert "Remove unpopular translations" This reverts commit a6b9c9c. * Update strings * Update versionCode * Update Spanish translation * Update versionCode and versionName * Update Spanish (#206) Co-authored-by: --marc <[email protected]>
@slavick Below are some observations on how the imperial/metric static strings are handled.
Currently Android and iOS handle the imperial/metric static strings for the detailed description differently.
Android separates the number value from rest of the string in XML and then recombines the number to the string in the code at run time.
The translation TSV spreadsheets have a full imperial string and separate a full metric string. Thus, for the translator, the string reads as is displayed and does not need to deal with any
%s
separations and formatting as exits in the XML file.For iOS, the imperial and metric translation strings from the spreadsheets are displayed without any additional processing.
If dynamic valued internationalized strings were needed, then iOS would use an object which supports
value
+units
+description
; and the spreadsheets would need to addvalue
andunits
columns. However, since the values are static the spreadsheet string is used directly for iOS.The XmlFromTsvProcessor.swift code has a method
measureDescriptionSplit(…)
which splits the 2 translator strings (imperial and metric) into the 3 strings (description, imperialMeasure, and metricMeasure) as used by Android XML. The Hebrew translator being (right-to-left) highlighted that this particular method is left-to-right centric. For example, the multi character values such as1/2
appeared to have issues which were subsequently avoided by using the single character½
.I'm wondering if the overall process could be more robust and simplified if the Android app also used the static imperial and metric strings directly.
It would be a minor adaption to disable the
measureDescriptionSplit(…)
and generate the Android localizedstrings.xml
files with the two separate imperial|metric strings instead of the 3 description|imperialMeasure|metricMeasure strings.Your thoughts?
The text was updated successfully, but these errors were encountered: