Reputation: 2028
I'm writing my first application using the Play! framework and I was wondering if there was a tool that could extract the messages that need translation from my views and controllers for me ? It is rather cumbersome to fill the conf/messages(.xx) file while I'm developing my app, but I'm afraid that if I don't do it as I go, I will never be able to completely translate my application afterwards.
Such tools exist with other framework such as CakePHP for instance, and I think that it shouldn't be hard to write one by myself, but if there already is one...
I was also wondering, what should I name the keys of the messages in my application ? Using gettext, it's not bad practice to directly type in the message in english as the key, but is it with the system that Play! uses (MessageFormat, right ?) ? Does anyone have an advice or naming convention (something like controller.action.describe_the_message maybe) ?
Thank you for your advices !
Upvotes: 1
Views: 102
Reputation: 2028
I created a small tool that automatically extracts the calls to Messages that are present in the source code and the templates of a Play! application to create the conf/messages.xx files for all the languages that you've defined into the configuration of your application.
You can find it here : https://github.com/Duhemm/PlayMessagesExtractor
Please note that the implementation is not very efficient as of today, but I plan on improving it in later releases.
I hope this will be useful to someone !
Upvotes: 0
Reputation: 55798
No, AFAIK there's no such tool and I agree it would be helpful one.
There's also no naming convention for translation keys, anyway your suggestion is clean approach and should help translating especially in bigger projects.
Upvotes: 1