View Single Post
Old 01-05-2012, 06:35 AM   #73
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Quote:
Originally Posted by ixtab View Post
If you're ok with it, I'd focus on the Java part and let you look into the JS part. That way, we should end up with better quality tools for both (the prior resource extraction script was just a hack, the new one does it in a much better way; and it's better to use a proper JS parser than just regexes).
I'm OK with JS part.

Quote:
Originally Posted by ixtab View Post
Good idea, and would probably work for the Java part. for JS I'm not entirely sure. As I mentioned in one of the posts above, there is at least one instance where there is actually JS code instead of a simple string, using a MessageFormat (or something the like) as the value. Maybe we can simply keep the *entire* value as the property (so e.g. for strings, including the simple, or double quotes around it. For potential "real" JS code, it is then up to the translator to make sure that what they commit is still valid JS)?
I think I've found this JS code. It's in media_player_bar_strings.js in value of trackCountMessageFormat property and consists of
Code:
new MessageFormat("Track {index} of {count}")
I think with JS parser I could recognize such instantiating of object, "split" it into syntax parts (upto string as parameter of function) and extract contained string into .properties as 'MediaPlayerBarStrings.trackCountMessageFormat (MessageFormat)=Track {index} of {count}' or something like it. Then on compiling .properties back just wrap translated string into 'new MessageFormat(...)' construction. Will see...

Certainly it will be not a general soultion but rather a "hardcoded" specific rule, but it's better than keep original JS source.

Quote:
Originally Posted by ixtab View Post
For the (new) Java props parser, the "finding" part is actually real easy. I simply find all classes which extend ResourceBundle, and then use normal Java to get the actual properties (getKeys/getObject). No parsing needed.

For writing back changes, I took a look around, and SERP (http://serp.sourceforge.net) looks good. (Other alternatives: http://java-source.net/open-source/bytecode-libraries). I'll see what can be done when I get to it (as announced earlier, I'm shorter on free time now... maybe over the weekend).
OK. Good luck!
eureka is offline   Reply With Quote