Closed Bug 999398 Opened 10 years ago Closed 10 years ago

Rename RawResource.get() to RawResource.getAsString()

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 31

People

(Reporter: lucasr, Assigned: lucasr)

References

Details

Attachments

(1 file)

For clarity.
Comment on attachment 8410235 [details] [diff] [review]
Rename RawResource.get() to RawResource.getAsString() (r=nalexander)

As suggested.
Attachment #8410235 - Flags: review?(nalexander)
Comment on attachment 8410235 [details] [diff] [review]
Rename RawResource.get() to RawResource.getAsString() (r=nalexander)

Review of attachment 8410235 [details] [diff] [review]:
-----------------------------------------------------------------

It works for me, but I really wonder if this is the right way to do this at all.  A raw resource immediately converted to a string... sounds like a string resource.  Use your discretion -- perhaps you have future raw resources in mind, etc.
Attachment #8410235 - Flags: review?(nalexander) → review+
(In reply to Nick Alexander :nalexander from comment #3)
> Comment on attachment 8410235 [details] [diff] [review]
> Rename RawResource.get() to RawResource.getAsString() (r=nalexander)
> 
> Review of attachment 8410235 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> It works for me, but I really wonder if this is the right way to do this at
> all.  A raw resource immediately converted to a string... sounds like a
> string resource.  Use your discretion -- perhaps you have future raw
> resources in mind, etc.

We're using raw resources as localizable 'assets' as opposed to a string that is directly translatable. The changes in bug 997772 should make it obvious how we're using them.

This is just a utility method to avoid code duplication for the different cases where need to read such asset as a string.
(In reply to Lucas Rocha (:lucasr) from comment #4)
> (In reply to Nick Alexander :nalexander from comment #3)
> > Comment on attachment 8410235 [details] [diff] [review]
> > Rename RawResource.get() to RawResource.getAsString() (r=nalexander)
> > 
> > Review of attachment 8410235 [details] [diff] [review]:
> > -----------------------------------------------------------------
> > 
> > It works for me, but I really wonder if this is the right way to do this at
> > all.  A raw resource immediately converted to a string... sounds like a
> > string resource.  Use your discretion -- perhaps you have future raw
> > resources in mind, etc.
> 
> We're using raw resources as localizable 'assets' as opposed to a string
> that is directly translatable. The changes in bug 997772 should make it
> obvious how we're using them.
> 
> This is just a utility method to avoid code duplication for the different
> cases where need to read such asset as a string.

This... is a really good explanation.  Add it to the RawResource class comment!

Note for my later self: adding these strings to strings.xml.in is not sufficient, because strings.xml.in is not part of the translation process (only the *_strings.dtd files are).
(In reply to Nick Alexander :nalexander from comment #5)
> (In reply to Lucas Rocha (:lucasr) from comment #4)
> > (In reply to Nick Alexander :nalexander from comment #3)
> > > Comment on attachment 8410235 [details] [diff] [review]
> > > Rename RawResource.get() to RawResource.getAsString() (r=nalexander)
> > > 
> > > Review of attachment 8410235 [details] [diff] [review]:
> > > -----------------------------------------------------------------
> > > 
> > > It works for me, but I really wonder if this is the right way to do this at
> > > all.  A raw resource immediately converted to a string... sounds like a
> > > string resource.  Use your discretion -- perhaps you have future raw
> > > resources in mind, etc.
> > 
> > We're using raw resources as localizable 'assets' as opposed to a string
> > that is directly translatable. The changes in bug 997772 should make it
> > obvious how we're using them.
> > 
> > This is just a utility method to avoid code duplication for the different
> > cases where need to read such asset as a string.
> 
> This... is a really good explanation.  Add it to the RawResource class
> comment!

Done. Pushed: https://hg.mozilla.org/integration/fx-team/rev/b9f340c5b1c9
https://hg.mozilla.org/mozilla-central/rev/b9f340c5b1c9
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 31
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.