localeDir is not working
Hi!
I defined localeDir property to point to the 'locale' directory
in the root of my project (this 'locale' directory contains
'en_US')
But it just is not working - 'locale' is not included into the swc
file.
I added a property locales=['en_US], but this does not help too.
What I'm doing wrong?
Thank you!
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac
Support Staff 1 Posted by Yennick Trevels on 06 Feb, 2013 07:42 AM
Did you define it in the project that has the GradleFx plugin applied?
Also, the path for localeDir should not start with a "/" in case you defined it like that.
2 Posted by Pavel Bernshtam on 06 Feb, 2013 07:46 AM
Yes, GradleFx plugin is applied (swc build finishes well, but the next swf build fails, because there is no locale properties) and locale dir is defined w/o '/'
My "parent" build file is:
My "child" build file:
I'm checking the content of swc file using 7-zip
Support Staff 3 Posted by Maxime Cowez on 06 Feb, 2013 10:05 AM
I took the liberty of formatting your code blocks to make it more readable (all code must be indented 4 spaces to be formatted correctly).
You don't seem to be showing us the swf build scripts.
As far as I can tell from this, there is no locale defined for the swf builds, only for the swc's, which seems to match the behaviour you describe.
4 Posted by Pavel Bernshtam on 06 Feb, 2013 10:20 AM
I have locale definition for all subprojects:
But even for swc build the locale does not compressed inside swc
Support Staff 5 Posted by Maxime Cowez on 06 Feb, 2013 10:32 AM
Could you be more explicit about the folder structure of your locales?
Does it look like:
6 Posted by Pavel Bernshtam on 06 Feb, 2013 10:43 AM
Yes, exactly. The file name is common.properties
Can I somehow debug the plugin?
Thank you
Support Staff 7 Posted by Maxime Cowez on 06 Feb, 2013 10:59 AM
You can run any gradle command with the
--infoor--debugflag, but I doubt it'll give you much more information since there is no real error.I reread your original question; perhaps I misunderstood. Did you expect the .properties file to be included in the swc?
This is not default behaviour: you have to explicitly add them using either
resourceDirsorincludeSourcesproperties (see the docs for more info on these properties).8 Posted by Pavel Bernshtam on 06 Feb, 2013 11:01 AM
So what is purpose of 'localeDir' property if I need include it explicitly?
Support Staff 9 Posted by Maxime Cowez on 06 Feb, 2013 11:25 AM
The content of those properties files is embedded in a swf or swc (so that ResourceManager can find the correct translations), but the file itself is not by default packaged into a swc.
So if you use ResourceManager inside the swc to use the translations in the properties files, there is no need to explicitly add the files to the swc. Their contents will be embedded in the swf (that's inside the swc) and ResourceManager will be able to do its job.
However, if your properties file is located in a library, and you want an application to use the information in that file, you'll have to add the file to the swc, so that the main application can embed it into its swf.
It's the same as with any type of asset really. If you embed an image inside a library; no need to include it in the swc. If you want to use an image from a library in an application; include the image in the swc.
10 Posted by Pavel Bernshtam on 10 Feb, 2013 09:14 AM
Thank you.
Finally I solved it by
additionalCompilerOptions << '-include-resource-bundles=common'
May be such option should be added to the plugin?
Support Staff 11 Posted by Yennick Trevels on 12 Feb, 2013 08:01 AM
include-resource-bundles is mainly used to create resource bundles though (swf's which contain localized resource bundles which can be loaded by a swf application), so while it may work I don't think it's the optimal solution.
As for adding such an option, I'd rather document how to do this (in some kind of how-to section) instead of adding another option. Adding more build-in options put an extra layer on top of the compiler, which makes the GradleFx code more complex and more error prone. Therefore I try to keep the build-in options to a minimum.