Gathering Strings for Localization

14 views
Skip to first unread message

Edi

unread,
Jun 15, 2017, 5:22:25 AM6/15/17
to Lift
Hello,

I'm looking for a way to gather all strings for localization. (using /resources-hidden/_resource_xx.html files)

My idea was I'd hook into the LiftRules.localizationLookupFailureNotice and write the strings to a file. 
Then I'd browse each page on the website to collect the strings.

Almost works :) 

Works for components where I call S.?()
Doesn't seem to work for <lift:loc> tags (does not seem to fire LiftRules.localizationLookupFailureNotice - though looking at the source code it should)

Anybody found a simpler way to do this? 

Thank you.

Antonio Salazar Cardozo

unread,
Jun 15, 2017, 2:04:27 PM6/15/17
to Lift
Is it possible lift:loc is hitting LiftRules.localizeStringToXml instead?

No simpler way to do it comes to mind off the top of my head, though perhaps
you could implement a resource bundle subclass that you then set as the parent
of the application's bundles. I believe missed lookups in the child resource bundles
then delegate to the parent, who could look out for them. This would be more
generic than hooking into Lift functionality to do it. Depends on whether you consider
that a positive or negative, though, and I've never done it before so there could be
caveats I'm not aware of ;) 
Thanks,
Antonio

j...@joescii.com

unread,
Jun 21, 2017, 5:30:33 PM6/21/17
to Lift
I've done extensive work for a client to localize a Lift app. We never even attempted to find a way to do what you are asking. This is due to the project size and that strings can originate in Scala code or Javascript code anyway.

The biggest reason I would discourage solving this problem by code scanning is rather pragmatic and business-oriented. We took the approach of localizing features / pages. Then you have something you can test and release incrementally. This might not be valuable in your case of course. 

Joe
Reply all
Reply to author
Forward
0 new messages