Closed
Bug 733515
Opened 13 years ago
Closed 13 years ago
Use localized strings for special folder names
Categories
(Firefox for Android Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 13
People
(Reporter: rnewman, Assigned: Margaret)
References
Details
Attachments
(1 file)
|
2.91 KB,
patch
|
lucasr
:
review+
rnewman
:
review+
|
Details | Diff | Splinter Review |
See <https://bugzilla.mozilla.org/show_bug.cgi?id=733481#c9>:
Fennec should also use a localized "magic" string for the title [of each special record], rather than looking in the database; if it doesn't, then folder names won't track localization switches on the device, rather keeping whichever title was in play when the DB was initialized.
| Assignee | ||
Comment 1•13 years ago
|
||
Luckily for us, the string are already there!
Attachment #603473 -
Flags: review?(lucasr.at.mozilla)
| Reporter | ||
Comment 2•13 years ago
|
||
Comment on attachment 603473 [details] [diff] [review]
patch
Review of attachment 603473 [details] [diff] [review]:
-----------------------------------------------------------------
::: mobile/android/base/AwesomeBarTabs.java
@@ +271,5 @@
> + String title;
> + String guid = c.getString(c.getColumnIndexOrThrow(Bookmarks.GUID));
> +
> + // Use localized strings for special folder names
> + if (guid.equals(Bookmarks.MOBILE_FOLDER_GUID))
Early returns?
Also, teensy bit of performance and NPE-safety: skip all of these string checks if the GUID is null or has length 12.
Length on a string is fast, and none of our special GUIDs (and all of our non-special GUIDs!) have a "regular" GUID. E.g.,
// Can't be a special GUID.
if (guid == null || guid.length == 12)
return c.getString(c.getColumnIndexOrThrow(Bookmarks.TITLE));
// Use localized strings for special folder names.
if (guid.equals(Bookmarks.MOBILE_FOLDER_GUID))
return BOOKMARKS_FOLDER_MENU_TITLE;
if (guid.equals(Bookmarks.TOOLBAR_FOLDER_GUID))
return BOOKMARKS_FOLDER_TOOLBAR_TITLE;
...
@@ +272,5 @@
> + String guid = c.getString(c.getColumnIndexOrThrow(Bookmarks.GUID));
> +
> + // Use localized strings for special folder names
> + if (guid.equals(Bookmarks.MOBILE_FOLDER_GUID))
> + title = mContext.getResources().getString(R.string.bookmarks_folder_mobile);
Is it worth caching these? (I don't know too much about the performance characteristics of Resources.)
Attachment #603473 -
Flags: review+
Comment 3•13 years ago
|
||
Comment on attachment 603473 [details] [diff] [review]
patch
Review of attachment 603473 [details] [diff] [review]:
-----------------------------------------------------------------
::: mobile/android/base/AwesomeBarTabs.java
@@ +272,5 @@
> + String guid = c.getString(c.getColumnIndexOrThrow(Bookmarks.GUID));
> +
> + // Use localized strings for special folder names
> + if (guid.equals(Bookmarks.MOBILE_FOLDER_GUID))
> + title = mContext.getResources().getString(R.string.bookmarks_folder_mobile);
Caching resources in a private mResources member seems doable here, given that we use it quite often here.
Attachment #603473 -
Flags: review?(lucasr.at.mozilla) → review+
| Assignee | ||
Comment 4•13 years ago
|
||
Comment 5•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 13
Updated•4 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•