blob: 2b58622bf0774c804c565647523b8d504ba61b73 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!-- saved from url=(0014)about:internet --><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="stylesheet" href="../../style.css" type="text/css" media="screen"><link rel="stylesheet" href="../../print.css" type="text/css" media="print"><link rel="stylesheet" href="../../override.css" type="text/css"><meta name="keywords" content="ResourceBundle,mx.resources.ResourceBundle,bundleName,bundleName,content,content,country,language,locale,locale,localeChain,variant,addResourceBundle,findResourceBundleWithResource,getBoolean,getBundleNamesForLocale,getClass,getContent,getInstance,getInt,getLocales,getNumber,getObject,getPreferredLocaleChain,getResourceBundle,getString,getStringArray,getUint,initializeLocaleChain,installCompiledResourceBundles,loadResourceModule,removeResourceBundle,removeResourceBundlesForLocale,toString,unloadResourceModule,update"><title>mx.resources.ResourceBundle</title></head><body><script language="javascript" type="text/javascript" src="../../asdoc.js"></script><script language="javascript" type="text/javascript" src="../../help.js"></script><script language="javascript" type="text/javascript" src="../../cookies.js"></script><script language="javascript" type="text/javascript"><!--
asdocTitle = 'ResourceBundle - ApacheFlex API Reference';
var baseRef = '../../';
window.onload = configPage;
--></script>
<script type="text/javascript">
scrollToNameAnchor();
</script><table class="titleTable" cellpadding="0" cellspacing="0" id="titleTable" style="display:none"><tr><td class="titleTableTitle" align="left">Apache Flex 4.16.1 API Reference </td><td class="titleTableTopNav" align="right"><a href="../../package-summary.html" onclick="loadClassListFrame('../../all-classes.html')">All Packages</a>&nbsp;|&nbsp;<a href="../../class-summary.html" onclick="loadClassListFrame('../../all-classes.html')">All Classes</a>&nbsp;|&nbsp;<a href="../../all-index-A.html" onclick="loadClassListFrame('../../index-list.html')">Index</a>&nbsp;|&nbsp;<a id="framesLink1" href="../../index.html?mx/resources/ResourceBundle.html&amp;mx/resources/class-list.html">Frames</a><a id="noFramesLink1" style="display:none" href="" onclick="parent.location=document.location"> No Frames </a></td><td class="titleTableLogo" align="right" rowspan="3"><img src="../../images/logo.jpg" class="logoImage" alt="AdobeLogo" title="AdobeLogo"></td></tr><tr class="titleTableRow2"><td class="titleTableSubTitle" id="subTitle" align="left">ResourceBundle</td><td class="titleTableSubNav" id="subNav" align="right"><a href="#propertySummary">Properties</a>&nbsp;| <a href="#methodSummary">Methods</a></td></tr><tr class="titleTableRow3"><td colspan="3">&nbsp;</td></tr></table><script language="javascript" type="text/javascript" xml:space="preserve">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("ResourceBundle"); titleBar_setSubNav(false,true,false,false,false,false,false,false,true,false,false ,false,false,false,false,false);}
-->
</script><div xmlns:fn="http://www.w3.org/2005/xpath-functions" class="MainContent"><table class="classHeaderTable" cellpadding="0" cellspacing="0"><tr><td class="classHeaderTableLabel">Package</td><td><a href="package-detail.html" onclick="javascript:loadClassListFrame('class-list.html')">mx.resources</a></td></tr><tr><td class="classHeaderTableLabel">Class</td><td class="classSignature">public class ResourceBundle</td></tr><tr><td class="classHeaderTableLabel">Inheritance</td><td class="inheritanceList">ResourceBundle <img src="../../images/inherit-arrow.gif" title="Inheritance" alt="Inheritance" class="inheritArrow"> Object</td></tr><tr><td class="classHeaderTableLabel">Implements</td><td> <a href="../../mx/resources/IResourceBundle.html">IResourceBundle</a></td></tr></table><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p></p><p></p>
Provides an implementation of the IResourceBundle interface.
The IResourceManager and IResourceBundle interfaces work together
to provide internationalization support for Flex applications.
<p>A Flex application typically has multiple instances of this class,
all managed by a single instance of the ResourceManager class.
It is possible to have ResourceBundle instances for multiple locales,
one for each locale. There can be multiple ResourceBundle instances with
different bundle names.</p>
<p></p><p><span class="classHeaderTableLabel">See also</span></p><div class="seeAlso"><a href="IResourceBundle.html" target="">mx.resources.IResourceBundle</a><br/><a href="IResourceManager.html" target="">mx.resources.IResourceManager</a></div><br/><hr></div><a name="propertySummary"></a><div class="summarySection"><div class="summaryTableTitle">Public Properties</div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableProperty"><tr><th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#bundleName" class="signatureLink">bundleName</a> : String<div class="summaryTableDescription">[read-only]
A name that identifies this resource bundle,
such as "MyResources".</div></td><td class="summaryTableOwnerCol">ResourceBundle</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#content" class="signatureLink">content</a> : Object<div class="summaryTableDescription">[read-only]
An object containing key-value pairs for the resources
in this resource bundle.</div></td><td class="summaryTableOwnerCol">ResourceBundle</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#locale" class="signatureLink">locale</a> : String<div class="summaryTableDescription">[read-only]
The locale for which this bundle's resources have been localized.</div></td><td class="summaryTableOwnerCol">ResourceBundle</td></tr></table></div><a name="methodSummary"></a><div class="summarySection"><div class="summaryTableTitle">Public Methods </div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableMethod"><tr><th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#ResourceBundle()" class="signatureLink">ResourceBundle</a>(locale:String = null, bundleName:String = null)</div><div class="summaryTableDescription">
Constructor.</div></td><td class="summaryTableOwnerCol">ResourceBundle</td></tr></table></div><a name="methodSummary"></a><a name="protectedMethodSummary"></a><div class="summarySection"><div class="summaryTableTitle">Protected Methods </div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableProtectedMethod"><tr><th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#getContent()" class="signatureLink">getContent</a>():Object</div><div class="summaryTableDescription">
When a properties file is compiled into a resource bundle,
the MXML compiler autogenerates a subclass of ResourceBundle.</div></td><td class="summaryTableOwnerCol">ResourceBundle</td></tr></table></div><script language="javascript" type="text/javascript"><!--
showHideInherited();
--></script><div class="MainContent"><div class="detailSectionHeader">Property Detail</div><a name="propertyDetail"></a><a name="bundleName"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">bundleName</td><td class="detailHeaderType">property</td></tr></table><div class="detailBody"><code>bundleName:String</code>&nbsp;&nbsp;[read-only] <p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
A name that identifies this resource bundle,
such as <code>"MyResources"</code>.
<p>This read-only property is set
when a resource bundle is constructed.</p>
<p>Resource bundles that are automatically created from compiled
properties files have bundle names based on the names of those files.
For example, a properties file named MyResources.properties
will produce a resource bundle whose <code>bundleName</code>
is <code>"MyResources"</code>.</p>
<p>The ResourceManager can manage multiple bundles with the same
<code>bundleName</code> as long as they have different values
for their <code>locale</code> property.</p>
</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function get bundleName():String</code><br/></div><a name="propertyDetail"></a><a name="content"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">content</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>content:Object</code>&nbsp;&nbsp;[read-only] <p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
An object containing key-value pairs for the resources
in this resource bundle.
<p>In general, you should access resources by using IResourceManager
methods such as <code>getString()</code>, rather than directly
accessing them in a resource bundle.
However, if you are programmatically creating your own
resource bundles, you can initialize them with resources,
as follows:</p>
<pre>
var rb:IResourceBundle = new ResourceBundle("fr_FR", "MyResources");
rb.content["LANGUAGE"] = "Francais";
rb.content["GREETING"] = "Bonjour";
</pre>
<p>When a resource bundle is produced by compiling a properties
file, its resource values are either of type String or Class.
For example, if the properties file contains</p>
<pre>
LANGUAGE=English
MINIMUM_AGE=18
ENABLED=true
LOGO=Embed("logo.png")
</pre>
<p>then the value of the <code>LANGUAGE</code> resource
is the String <code>"English"</code>,
the value of the <code>MINIMUM_AGE</code> resource
is the String <code>"18"</code>,
the value of the <code>ENABLED</code> resource
is the String <code>"true"</code>,
and the value of the <code>LOGO</code> resource
is a Class that represents the embedded PNG file.</p>
<p>You can use IResourceManager methods such as <code>getInt()</code>
and <code>getBoolean()</code> to convert resource strings like
<code>"18"</code> and <code>"true"</code> into the type
that your code expects.</p>
</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function get content():Object</code><br/></div><a name="propertyDetail"></a><a name="locale"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">locale</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>locale:String</code>&nbsp;&nbsp;[read-only] <p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
The locale for which this bundle's resources have been localized.
This is a String such as <code>"en_US"</code> for U.S. English.
<p>This read-only property is set
when a resource bundle is constructed.</p>
<p>Resource bundles that are automatically created from compiled
properties files have locales based on the
<code>-compiler.locale</code> option of the mxmlc or compc compilers.
For example, suppose that you compile your application with the option
<code>-compiler.locale=en_US,ja_JP</code> and that you have specified
<code>-compiler.source-path=resources/{locale}</code> so that
your application's resources, located in
resources/en_US/MyResources.properties and
resources/ja_JP/MyResources.properties, are found.
Then your application will have two resource bundles
whose <code>bundleName</code> is <code>"MyResources"</code>,
one whose <code>locale</code> is <code>"en_US"</code>
and one whose <code>locale</code> is <code>"ja_JP"</code>.</p>
</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function get locale():String</code><br/></div><a name="constructorDetail"></a><div class="detailSectionHeader">Constructor Detail</div><a name="ResourceBundle()"></a><a name="ResourceBundle(String,String)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">ResourceBundle</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">Constructor</td></tr></table><div class="detailBody"><code>public function ResourceBundle(locale:String = null, bundleName:String = null)</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p>
Constructor.
</p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">locale</span>:String</code> (default = <code>null</code>)<code></code> &mdash; A locale string, such as <code>"en_US"</code>.
</td></tr><tr><td class="paramSpacer">&nbsp;</td></tr><tr><td width="20px"></td><td><code><span class="label">bundleName</span>:String</code> (default = <code>null</code>)<code></code> &mdash; A name that identifies this bundle,
such as <code>"MyResources"</code>.
</td></tr></table></div><a name="methodDetail"></a><div class="detailSectionHeader">Method Detail</div><a name="getContent()"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">getContent</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td></tr></table><div class="detailBody"><code> protected function getContent():Object</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
When a properties file is compiled into a resource bundle,
the MXML compiler autogenerates a subclass of ResourceBundle.
The subclass overrides this method to return an Object
that contains key-value pairs for the bundle's resources.
<p>If you create your own ResourceBundle instances,
you can set the key-value pairs on the <code>content</code> object.</p>
</p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code>Object</code> &mdash; The Object that contains key-value pairs for the bundle's resources.
</td></tr></table></div><br/><br/><hr><br/><p></p><center class="copyright"><footer>The Apache Software Foundation</footer><br/>Wed Nov 15 2017, 09:50 AM +01:00 </center></div></body></html><!--The Apache Software Foundation<br/>Wed Nov 15 2017, 09:50 AM +01:00 -->