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

RESOLVED FIXED in Firefox 31

Status

()

defect
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: lucasr, Assigned: lucasr)

Tracking

unspecified
Firefox 31
All
Android
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

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: 5 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 31
You need to log in before you can comment on or make changes to this bug.