Thursday, December 18, 2008

Flex 3 - Unable to resolve resource bundle error


While implementing Flex ResourceBundle using .properties files, I ran into a strange problem. Although my Locale folder was added to the build path, Flex could not find it and could not resolve the ResourceBundles. I Googled things up and found the problem, it looks like a Flex 3 issue...

Instead of specifying the locale folder in the build path (which sounds like the correct way to do it), add it to the "Additional compiler arguments" in the project's compiler tab.

To do this, simply right click your project > properites > Flex compiler and add "-source-path ../locale/{locale}" to the Aditional compiler arguments text field.

(note that my locale folder is under /locale/en_US/)



Once your done you'll be able to use this very powerful feature.
Note that in case you are using Ant you would also need to add the locale folder location as source-path path-element to the tags:

<mxmlc>
.
<source-path path-element="locale/{locale}"/>
.
</mxmlc>

13 comments:

SD said...

Thanks man

Anonymous said...

thank you ... you saved us from hours of pain...

Ramdas said...

thanks a lot

Ruben said...

Thanks a lot!!!

Anonymous said...

Hi,
Thank-you! But...

You've solved one (actually a number) of problems with setting up an inherited project from another developer, but I have another one.

I have installed SDK 4.0 onto Flex 3 and (despite all the files being there, apparently) I can't reference or use any of the mx: namespace.

I'm guessing it is a very similar cause and thought you might have an idea?

Thanks,
G

PalMediC said...

Thank you SOOOO much, you spared me hours of looking for such solution.

Anviliis said...

Solved my error but now I'm getting the warning:


'C:\Documents and Settings\bhl\Adobe Flash Builder 4\SagphApplications\src\locale\en_US', is a subdirectory of source path entry, 'C:\Documents and Settings\bhl\Adobe Flash Builder 4\SagphApplications\src'

is this anything to worry about?

Lior Boord said...

@Anviliis try to add this to your compiler arguments: -allow-source-path-overlap=true

dilino said...

Thanks a lot! Or "Danke" as we say here ... ;-)

kavi said...

Thanks a lot! i was struggling with compiling swf with resource bundle for flex monkey.

It is helped me lot.

Thanks
Kavi

Joey said...

How would you do this as an mxmlc argument?

Anonymous said...

Thanks ... :))

krishnam G said...

Thanks man! that saved my day