|
6 | 6 | import json |
7 | 7 | import re |
8 | 8 | from itertools import count |
| 9 | +from typing import Tuple |
9 | 10 |
|
10 | 11 | import six |
11 | 12 |
|
@@ -729,6 +730,14 @@ def _copy_until_and_remove_section(self, pos): |
729 | 730 | self.transcriber.remove_section() |
730 | 731 |
|
731 | 732 |
|
| 733 | + def add_strings_to_template( |
| 734 | + self, template: str, stringset: list[OpenString] |
| 735 | + ) -> str: |
| 736 | + """ |
| 737 | + Adds strings to the template that are not in the template currently. |
| 738 | + """ |
| 739 | + return template |
| 740 | + |
732 | 741 | class StructuredJsonHandler(JsonHandler): |
733 | 742 | """Handler that preserves certain keys for internal usage, while |
734 | 743 | keeping the flexibility and functionality of the original JsonHandler. It |
@@ -1116,6 +1125,21 @@ def _copy_until_and_remove_section(self, pos): |
1116 | 1125 | # Unlike the JSON format, do not remove the remaining section of the |
1117 | 1126 | # template |
1118 | 1127 |
|
| 1128 | + def remove_strings_from_template( |
| 1129 | + self, template: str, stringset: list[OpenString] |
| 1130 | + ) -> str: |
| 1131 | + """ |
| 1132 | + Removes strings from the template that are not in the stringset. |
| 1133 | + """ |
| 1134 | + return template |
| 1135 | + |
| 1136 | + def add_strings_to_template( |
| 1137 | + self, template: str, stringset: list[OpenString] |
| 1138 | + ) -> str: |
| 1139 | + """ |
| 1140 | + Adds strings to the template that are not in the template currently. |
| 1141 | + """ |
| 1142 | + return template |
1119 | 1143 |
|
1120 | 1144 | class ChromeI18nHandler(JsonHandler): |
1121 | 1145 | """Responsible for CHROME files, based on the JsonHandler.""" |
@@ -1197,6 +1221,22 @@ def validate_content(self, content): |
1197 | 1221 | except ValueError as e: |
1198 | 1222 | raise ParseError(six.text_type(e)) |
1199 | 1223 |
|
| 1224 | + def remove_strings_from_template( |
| 1225 | + self, template: str, stringset: list[OpenString] |
| 1226 | + ) -> str: |
| 1227 | + """ |
| 1228 | + Removes strings from the template that are not in the stringset. |
| 1229 | + """ |
| 1230 | + return template |
| 1231 | + |
| 1232 | + def add_strings_to_template( |
| 1233 | + self, template: str, stringset: list[OpenString] |
| 1234 | + ) -> str: |
| 1235 | + """ |
| 1236 | + Adds strings to the template that are not in the template currently. |
| 1237 | + """ |
| 1238 | + return template |
| 1239 | + |
1200 | 1240 |
|
1201 | 1241 | class ChromeI18nHandlerV3(Handler): |
1202 | 1242 | """New version of chrome-json handler. |
@@ -1417,6 +1457,22 @@ def compile(self, template, stringset, **kwargs): |
1417 | 1457 |
|
1418 | 1458 | return compiled |
1419 | 1459 |
|
| 1460 | + def remove_strings_from_template( |
| 1461 | + self, template: str, stringset: list[OpenString] |
| 1462 | + ) -> str: |
| 1463 | + """ |
| 1464 | + Removes strings from the template that are not in the stringset. |
| 1465 | + """ |
| 1466 | + return template |
| 1467 | + |
| 1468 | + def add_strings_to_template( |
| 1469 | + self, template: str, stringset: list[OpenString] |
| 1470 | + ) -> str: |
| 1471 | + """ |
| 1472 | + Adds strings to the template that are not in the template currently. |
| 1473 | + """ |
| 1474 | + return template |
| 1475 | + |
1420 | 1476 | @staticmethod |
1421 | 1477 | def escape(string): |
1422 | 1478 | return escape(string) |
|
0 commit comments