Closed Bug 1163151 Opened 9 years ago Closed 9 years ago

Firefox for iOS: verify usage of \n in strings

Categories

(Firefox for iOS :: Browser, defect)

Other
iOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: flod, Assigned: st3fan)

References

Details

Attachments

(4 files)

This just landed
https://github.com/mozilla/firefox-ios/commit/7998e3b6f69c46fda3631dc61d8b8d6bd7803c68

The exported XLIFF looks weird: no sign of \n, it' stripped in the string ID, it's converted to an actual new line in the source element.

-      <trans-unit id="Are you sure you want to clear all of your data? This will also close all open tabs.">
-        <source>Are you sure you want to clear all of your data? This will also close all open tabs.</source>
-        <target>Eliminare tutti i dati? Verranno anche chiuse tutte le schede aperte.</target>
+      <trans-unit id="Are you sure you want to clear all of your data?   This will also close all open tabs.">
+        <source>Are you sure you want to clear all of your data? 
+ This will also close all open tabs.</source>

I tried to modify a local file, import it in XCode but it doesn't seem to work. Can someone double check?

Also no idea how tools would react to this \n
Love commits without bug numbers, https://github.com/mozilla/firefox-ios/pull/433

I think that we should add info about line break in comment also (easy too ignore if only actual line break in source file) before next strings export.
Attached image import.png
Had a bit more time for testing. The string ID looks like this

id="Are you sure you want to clear all of your data?   This will also close all open tabs."

Notice that there's no \n anywhere.

Side note: the string has trailing whitespaces, so my editor was trimming them off.

But check the screenshot to see what happens when you try to import the localization (you can try with Italian, it's up to date). The string is not recognized, and the string is displayed in English in the simulator.

It doesn't improve if I run /scripts/import-locales.sh

I think you need to back this out and restore the previous string. If you need to display these strings in two separate lines, we probably need two separate strings.
Attached patch fixSplinter Review
(In reply to Stefan Plewako [:stef] from comment #3)
> Created attachment 8604091 [details] [diff] [review]

Import/export works as expected, I have some unrelated problem with building locally, so it would be great if someone could test if it works as expected in UI.
Unfortunately it doesn't work: export and import work great, but in the app it's displayed as a literal "\n", not converted to a new line.
Assignee: nobody → sarentz
Attached image Italian Build
Updated XCode to 6.3.2, now the exports has "\n" in the ID (see r141650 for Italian), and the code works.

<trans-unit id="Are you sure you want to clear all of your data? \n This will also close all open tabs.">

Should we consider this a WORKSFORME? Still a bit scared by seeing what tools will do.
Looks like tools don't like it:
http://mozilla.locamotion.org/sv/ios/translate/firefox-ios.xliff#unit=18069784

Shall we just use two separate strings?
So I actually chose the easy way out here and removed the newline character. See the attached screenshot how this looks. I think it is fine and it actually looks better in English because without the newline the last word 'data?' was alone on a single line.

We must make note of this issue though for future strings.

https://github.com/mozilla/firefox-ios/commit/0f491a644b4b32a52ea170d1137b93caefe312dc
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Screenshot of dialog after removing the newline
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: