Cmobilecom AF 5.19 Developer Guide

19 Resource Bundles

Resource bundles are used for application internationalization, including Cmobilecom AF core, module, app, site and installation resource bundles. Bundle base names and locations: Resource bundles are used in displaying messages, exceptions, entity type names, property names, menu node names, command names, select item labels, dialog/bean titles, form designs, role/permission names, embedded objects, etc. Expression #{bundle.Key} can be used in form designs, layout code and web pages.

Supported Locales

Supported locales for resource bundles are specified in conf/system-config.xml. For example,

	<property name="resource.bundle.locales" value="zh,fr,es"/>
It is a list of language tags. English locale(en) is the ROOT that will be included by system. They are used as locales for creating Mail Templates. see System Configuration for detail.

Core Resource Bundles

Cmobilecom AF core resource bundles are the root of resource bundle hierarchy.
			Core Resource Bundles
					|
			Module Resource Bundles
					|
			App Resource Bundles
					|
		Site Resource Bundle Hierarchy
Like other modules, resource bundles of built-in modules (System, FTP, Website) are module resource bundles.

Module Resource Bundles

The message bundle for default locale(fallback) is messages.properties in English. For other locales, add messages_[locale].properties. For example,
	moduleRootDir/src/main/resources/bundle
		messages.properties
		messages_zh.properties
		messages_fr.properties
The messages properties include I18N translations for entity types and their properties, commands and various messages. In addition, they also include I18N translations for permissions, roles(if any) and form design names. For example,
	# Permissions
	HR.ModuleAll=HR: All Permissions
	HR.ModuleView=HR: View
	HR.ModuleInit=HR: Initialize

	HR.ManageADDR=HR: Manage Addresses
	HR.ManageDEPT=HR: Manage Departments
	HR.ManageEMP=HR: Manage Employees
	HR.ViewEMP=HR: View Employees

	HR.ManageEC=HR: Manage Expense Claims
	HR.ViewEC=HR: View Expense Claims
	HR.ApproveEC=HR: Approve Expense Claims

	# Roles
	Role.HRManager=HR Manager

	# Form Designs
	FormDesign.ExpenseClaimStandard=Expense Claim Form (Standard)
	FormDesign.ExpenseClaimNew=Expense Claim Form (New)
A permission belongs to a module and its name is prefixed with module name. But the scope of a role is its DataAccessUnit, and it can be assigned permissions from different modules. When displaying a role, if its description is not set, then the message key Role.<roleName> of resource bundle, if found, will be used as role description.

Application Resource Bundles

Application resource bundles are under application root directory. For example,
	appRootDir/resources/bundle/
		messages.properties
		messages_zh.properties
		messages_fr.properties
		messages_es.properties
Build script will change the bundle base name to app.bundle.messages, which will be in runtime classpath after application is deployed. See Project Build: Application Resources for more info.

Site Resource Bundles

Site Resource Bundles are inheritable in site inheritance hierarchy. Each site can have its resource bundles to override inherited key/value pairs.

Refer to Website module documentation for details.

Installer Resource Bundles

Application additional resource bundles for installer. See Project Build: Install Resource Bundles for more info.

Add Resource Bundles for New Locales

To add Resource Bundles for a new locale:
Report and ChartingModule DevelopmentFrames / No Frames