Skip to content

Commit b397bb7

Browse files
authored
Add translation descriptions to String resources. (android#120)
* Add translation descriptions to String resources. Also remove label from GardenActivity in AndroidManifest * Collapse string resources to a single line for better usage in the Translation Editor * Add singular and plural hints
1 parent 01c18de commit b397bb7

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
android:theme="@style/AppTheme">
3131
<activity
3232
android:name=".GardenActivity"
33-
android:label="@string/app_name"
3433
android:theme="@style/AppTheme.NoActionBar">
3534
<intent-filter>
3635
<action android:name="android.intent.action.MAIN" />

app/src/main/res/values/strings.xml

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,39 @@
1515
-->
1616

1717
<resources>
18-
<string name="app_name">Sunflower</string>
19-
<string name="menu_filter_by_grow_zone">Filter by grow zone</string>
20-
<string name="plant_detail_image_content_description">Image of plant</string>
21-
<string name="my_garden_title">My garden</string>
22-
<string name="plant_list_title">Plant list</string>
23-
<string name="plant_details_title">Plant details</string>
24-
<string name="navigation_drawer_header_title">Sunflower</string>
25-
<string name="navigation_drawer_header_content_description">
26-
Navigation drawer header logo
27-
</string>
28-
<string name="added_plant_to_garden">Added plant to garden</string>
29-
<string name="garden_empty">Your garden is empty</string>
30-
<string name="planted_date">%1$s planted on %2$s</string>
31-
32-
<string name="watering_needs_prefix">Watering needs:</string>
18+
19+
<!-- Resources that do not require translation -->
20+
<string name="app_name" translatable="false">Sunflower</string>
21+
<string name="navigation_drawer_header_title" translatable="false">Sunflower</string>
22+
23+
<!-- Translatable resources -->
24+
<string name="menu_filter_by_grow_zone" translation_description="The label for the menu item to filter the displayed plants by grow zone.">Filter by grow zone</string>
25+
<string name="plant_detail_image_content_description" translation_description="Content description for the header / hero image that is show at the top of the plant detail screen.">Image of plant</string>
26+
<string name="my_garden_title" translation_description="Title for the 'My garden' screen where the user can see the list of plants that have been added to their garden.">My garden</string>
27+
<string name="plant_list_title" translation_description="Title for the plant list screen where the user can see a list of plants available to add to their garden.">Plant list</string>
28+
<string name="plant_details_title" translation_description="Title for the plant details screen where the user can see the details for a specific plant.">Plant details</string>
29+
<string name="navigation_drawer_header_content_description" translation_description="Content description for the image that is shown at the top of the navigation drawer.">Navigation drawer header logo</string>
30+
<string name="added_plant_to_garden" translation_description="Confirmation text that is shown when a user adds a plant to their graden.">Added plant to garden</string>
31+
<string name="garden_empty" translation_description="Text that is shown on the 'My Garden' screen when no plants have been added to the user's garden">Your garden is empty</string>
32+
<string name="planted_date" translation_description="Text with placeholders that indicates when the plant was planted. Example: 'Sunflower planted on May 24, 2018'.">%1$s planted on %2$s</string>
33+
34+
<!-- String plurals and their related prefix / suffix strings -->
35+
<string name="watering_needs_prefix" translation_description="Prefix for the text describing how often a plant should be watered. Used in combination with watering_needs_suffix.">Watering needs:</string>
3336
<plurals name="watering_needs_suffix">
34-
<item quantity="one">every day</item>
35-
<item quantity="other">every %d days</item>
37+
<item quantity="one" translation_description="Suffix for the text describing how often a plant should be watered, singular. Used in combination with watering_needs_prefix: 'Watering needs: every day'.">every day</item>
38+
<item quantity="other" translation_description="Suffix for the text describing how often a plant should be watered, plural. Used in combination with watering_needs_prefix: 'Watering needs: every 8 days'.">every %d days</item>
3639
</plurals>
3740

38-
<string name="watering_next_prefix">Last watered on %s</string>
41+
<string name="watering_next_prefix" translation_description="Prefix for the text indicating when the plant should next be watered. Used in combination with watering_next_suffix.">Last watered on %s</string>
3942
<plurals name="watering_next_suffix">
40-
<item quantity="one">water tomorrow.</item>
41-
<item quantity="other">water in %d days.</item>
43+
<item quantity="one" translation_description="Suffix for the text indicating when the the plant should next be watered, singular. Used in combination with watering_next_prefix: 'Last watered on May 24, 2018 - water tomorrow.'.">water tomorrow.</item>
44+
<item quantity="other" translation_description="Suffix for the text indicating when the the plant should next be watered, plural. Used in combination with watering_next_prefix: 'Last watered on May 24, 2018 - water in 8 days.'.">water in %d days.</item>
4245
</plurals>
4346

4447
<string name="share_title">Share</string>
4548
<string name="share_text">Check out the %s plant in the Android Sunflower app</string>
4649

4750
<!-- Accessibility -->
48-
<string name="a11y_plant_item_image">Picture of plant</string>
51+
<string name="a11y_plant_item_image" translation_description="Accessibility text for each of the plant images shown in the 'My garden' and 'Plant list' screens.">Picture of plant</string>
4952

5053
</resources>

0 commit comments

Comments
 (0)