Example #1
0
    def test_write_8(self):
        self.maxDiff = 1024
        strings_table = StringsTable(os.path.join(source_root, 'example.strings'), encoding='utf-8')

        with tempfile.TemporaryDirectory() as tmp_dir:
            output_file_path = os.path.join(tmp_dir, 'example.strings')
            strings_table.write_file(output_file_path, encoding='utf-8')

            with open(output_file_path, 'r') as f:
                result = f.read()

            self.assertEqual(result, r'''/* Some comemnt */
"%@ doesn't have a list named %@." = "%1$@ は %2$@ というリストをもっていません。";

/* Error message when Tickle tries to open a document but fails to fetch the version info,
   English source is "Cannot get the version of this Tickle document." */
"Cannot get the version of this Tickle document." = "Cannot get the version of this Tickle document.";

"No comment" = "沒有註解";

/* Comment with "quote" */
"String with \"quote\".\"" = "有引號的字\"";

/* String with = */
"String with =" = "String with =";

/* String with semicolon */
"String with ;" = "String with ;";

/* String with spaces */
"String\twith \n" = "String\twith \n";

/* Not translated */
"String not translated" = "";
''')