mxmlc错误:无法解析语言环境“y”的资源包“X”:ANT构建问题

时间:2013-01-21 20:07:43

标签: actionscript-3 flex ant localization flex4.5

我知道这个话题有很多类似的问题和答案,但我仍然遇到同样的问题。到目前为止,我已查看thisthisthisthisthis等等。无济于事。

当我尝试在项目上运行ANT构建时,我总是遇到此错误。

    [mxmlc] Error: Unable to resolve resource bundle "resources" for locale "en_US".

BUILD FAILED
C:\***\flashWorkspace\shop\build.xml:8: The following error occurred while executing this line:
C:\***\flashWorkspace\Scripts\flex-build.xml:50: The following error occurred while executing this line:
C:\***\flashWorkspace\Scripts\flex-build.xml:123: mxmlc task failed

我的build.xml:

<target name="compile" depends="common-build.compile">
    <antcall target="flex-build.compile-air-application"/>   // line 8
</target>

这将我们带到我的flex-build.xml(这是我将调用抛出错误的宏的地方):

<target name="compile-air-application">
    <compileSWF>      // line 50
        <compiler-options>
            <load-config filename="${FLEX_HOME}/frameworks/air-config.xml"/>
        </compiler-options>
    </compileSWF>            
</target>

最后,宏本身包含错误的mxmlc调用:

<macrodef name="compileSWF">
    <element name="compiler-options" optional="yes"/>
    <attribute name="sourceDir" default="${src.dir}"/>
    <attribute name="libraryDir" default="${build.lib.dir}"/>
    <attribute name="buildDir" default="${build.dir}"/>
    <attribute name="locale" default="${locale}"/>
    <attribute name="applicationFile" default="${application.file}"/>
    <attribute name="outputFile" default="${swf.file}"/>
    <sequential>
        <delete file="@{buildDir}/@{outputFile}"/>
        <mxmlc file="@{sourceDir}/@{applicationFile}" output="@{buildDir}/@{outputFile}" locale="@{locale}">          //line 123
            <compiler-options/>
            <source-path path-element="@{sourceDir}"/>
            <compiler.library-path dir="@{libraryDir}" append="true">
                <include name="*.swc"/>
            </compiler.library-path>
        </mxmlc>
    </sequential>
</macrodef>

这些是我的编译器参数:

-locale=en_US,fr_FR -source-path=locale/{locale}

基本上我的文件夹结构就像这样

Proj 
  |-- src 
  |-- lib 
  |-- locale 
          |-- en_US
               |-- resources.properties     
          |-- fr_FR 
               |-- resources.properties 

有人能看出我的ANT版本有什么问题吗?如果您需要更多信息,我将很乐意编辑并将其添加到帖子中。我尝试过网上发现的无数黑客攻击:我一直在努力解决这个问题:/

提前致谢

1 个答案:

答案 0 :(得分:2)

对于其他有这个问题的人来说,通过添加这两个指令来解决这个问题:

            **<source-path>locale/{locale}</source-path>
            <include-resource-bundles>resources</include-resource-bundles>**

所以mxmlc看起来像这样

<mxmlc file="@{sourceDir}/@{applicationFile}" output="@{buildDir}/@{outputFile}" locale="@{locale}">
    <compiler-options/>
    <source-path>locale/{locale}</source-path>
    <include-resource-bundles>resources</include-resource-bundles>
    <source-path path-element="@{sourceDir}"/>
    <compiler.library-path dir="@{libraryDir}" append="true">
        <include name="*.swc"/>
    </compiler.library-path>
</mxmlc>