Update gen_strings.py based on the updated format for using plural
strings.
Test: Manual atest
Bug: 199229956
Change-Id: I1bdb1edeebe71096b62f7496fcf8b9efca7934ff
(cherry picked from commit b95bd17191b37fec93e89c6c50b3e3be818aa67b)
diff --git a/gen_strings.py b/gen_strings.py
index a3d98be..23b3315 100755
--- a/gen_strings.py
+++ b/gen_strings.py
@@ -38,42 +38,42 @@
if verb == "trash":
print Template('''
<!-- Dialog title asking if user will allow $verb permission to the $data item displayed below this string. [CHAR LIMIT=128] -->
-<plurals name="permission_${verb}_${data}">
- <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this $datalabel to trash?</item>
- <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> ${datalabel}s to trash?</item>
-</plurals>
+<string name="permission_${verb}_${data}"> {count, plural,
+ =1 {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this $datalabel to trash?}
+ other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> ${datalabel}s to trash?}
+}</string>
''').substitute(vars()).strip("\n")
print Template('''
<!-- Progress dialog message after user allows $verb permission to the $data item [CHAR LIMIT=128] -->
-<plurals name="permission_progress_${verb}_${data}">
- <item quantity="one">Moving $datalabel to trash…</item>
- <item quantity="other">Moving <xliff:g id="count" example="42">^1</xliff:g> ${datalabel}s to trash…</item>
-</plurals>
+<string name="permission_progress_${verb}_${data}"> {count, plural,
+ =1 {Moving $datalabel to trash…}
+ other {Moving <xliff:g id="count" example="42">^1</xliff:g> ${datalabel}s to trash…}
+}</string>
''').substitute(vars()).strip("\n")
elif verb == "untrash":
print Template('''
<!-- Dialog title asking if user will allow $verb permission to the $data item displayed below this string. [CHAR LIMIT=128] -->
-<plurals name="permission_${verb}_${data}">
- <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this $datalabel out of trash?</item>
- <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> ${datalabel}s out of trash?</item>
-</plurals>
+<string name="permission_${verb}_${data}"> {count, plural,
+ =1 {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this $datalabel out of trash?}
+ other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> ${datalabel}s out of trash?}
+}</string>
''').substitute(vars()).strip("\n")
print Template('''
<!-- Progress dialog message after user allows $verb permission to the $data item [CHAR LIMIT=128] -->
-<plurals name="permission_progress_${verb}_${data}">
- <item quantity="one">Moving $datalabel out of trash…</item>
- <item quantity="other">Moving <xliff:g id="count" example="42">^1</xliff:g> ${datalabel}s out of trash…</item>
-</plurals>
+<string name="permission_progress_${verb}_${data}"> {count, plural,
+ =1 {Moving $datalabel out of trash…}
+ other {Moving <xliff:g id="count" example="42">^1</xliff:g> ${datalabel}s out of trash…}
+}</string>
''').substitute(vars()).strip("\n")
else:
print Template('''
<!-- Dialog title asking if user will allow $verb permission to the $data item displayed below this string. [CHAR LIMIT=128] -->
-<plurals name="permission_${verb}_${data}">
- <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to $verblabel this $datalabel?</item>
- <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to $verblabel <xliff:g id="count" example="42">^2</xliff:g> ${datalabel}s?</item>
-</plurals>
+<string name="permission_${verb}_${data}"> {count, plural,
+ =1 {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to $verblabel this $datalabel?}
+ other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to $verblabel <xliff:g id="count" example="42">^2</xliff:g> ${datalabel}s?}
+}</string>
''').substitute(vars()).strip("\n")
if verb == "write":
actionLabel = "Modifying"
@@ -81,10 +81,10 @@
actionLabel = "Deleting"
print Template('''
<!-- Progress dialog message after user allows $verb permission to the $data item [CHAR LIMIT=128] -->
-<plurals name="permission_progress_${verb}_${data}">
- <item quantity="one">$actionLabel $datalabel…</item>
- <item quantity="other">$actionLabel <xliff:g id="count" example="42">^1</xliff:g> ${datalabel}s…</item>
-</plurals>
+<string name="permission_progress_${verb}_${data}"> {count, plural,
+ =1 {$actionLabel $datalabel…}
+ other {$actionLabel <xliff:g id="count" example="42">^1</xliff:g> ${datalabel}s…}
+}</string>
''').substitute(vars()).strip("\n")
print '''