You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Frédéric THOMAS <we...@hotmail.com> on 2013/10/15 15:44:41 UTC

[FlexMojos] Compiling resource modules

Hi,
 
I've got the requirement to create 3 runtime locales resource bundles for the main applications which will be loaded as needed at runtime, the main app has no compiled locales declared.
 
This [1] is how to do with the mxmlc compiler, my problem is that:
flexmojos-maven-plugin:6.0.1:compile-swf failed: SourceFile not specified and no default found!
 
FM complains because there's no sources which is normal, the sources are in the main app.
In src/main/flex I have my locale property files, one folder per locale.
 
My question is, how can I achieve that ?

 
This is my pom.xml for one of them:
 
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>myGroupId</groupId>
        <artifactId>ResourceBundles</artifactId>
        <version>6.2-SNAPSHOT</version>
    </parent>
    <artifactId>Resources</artifactId>
    <packaging>swf</packaging>

    <build>
        <plugins>
            <plugin>
                <groupId>net.flexmojos.oss</groupId>
                <artifactId>flexmojos-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <storepass/>
                    <localesRuntime>
                        <locale>en_US</locale>
                        <locale>fr_FR</locale>
                        <locale>de_DE</locale>
                    </localesRuntime>
                    <localesSourcePath>${basedir}/src/main/flex/{locale}</localesSourcePath>
                    <resourceBundleNames>{artifactId}-{locale}-{classifier}</resourceBundleNames>
                    <includeResourceBundles>
                        <rb>Resources</rb>
                    </includeResourceBundles>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
 
Thanks,
Frédéric THOMAS
 
[1] from http://livedocs.adobe.com/flex/3/html/help.html?content=l10n_5.html
Compiling a resource moduleTo compile a resource module, you must use the mxmlc command-line compiler. You cannot compile resource modules by using Flex Builder. The output is a SWF file that you can then load at run time.To compile a resource module on the command line, use the following guidelines:Do not specify an MXML file to compile.Specify the include-resource-bundles option.Specify the locale by using the locale option.Add the locales to the source path.The include-resource-bundles option takes a comma-separated list of resource bundles to include in the resource module. You generated this list of required resource bundles in Determining the required resource bundles to include in a resource module.When compiling a resource module, you must also specify the locale by using the locale option.The following example compiles a resource module for the en_US locale:mxmlc -locale=en_US     -source-path=locale/{locale}    -include-resource-bundles=RegistrationForm,collections,containers,controls,core,     effects,skins,styles     -output en_US_ResourceModule.swf

You can compile the resources for only a single locale into each resource module. As a result, you cannot specify more than one locale for the locale option.You should use a common naming convention for all of your locales' resource modules. For example, specify the locale in the SWF file's name, but keep the rest of the file name the same for all locales. This is because when you load the resource module, you want to be able to dynamically determine which SWF file to load. In the previous example, the resource module for the en_US locale is named en_US_ResourceModule.swf. If you then generated a resource module for the es_ES locale, it would be named es_ES_ResourceModule.swf.