j18n Tutorial
Resources
Resources in this context are a:
path + name
an optional description
a set of super-resources
Within j18n, here we are referring to ResourceTemplates.
In short, menu
is a resource, menu_es
is not (in this context), i.e.
they are locale-independent.
Discerning readers might wonder about message keys (and notes).
Aren't they part of a ResourceTemplate?
Structurally, yes. But message keys and notes are defined in the Master IDE
(together with master content). In this way, the familiarity of editing
java .properties files is maintained.
Resource List
Plans: All
Navigation: Resources Menu
Displays all of the resources for the current project in a treeview-like manner (grouped
by path).
This view's primary purpose is navigational; this is how all roles get to the IDE that
they want. In addition, Administrators and Developers can add, edit and delete resources.
Note: deleting a resource will permanently delete all of its ResourceInstances,
master and foreign (all content and versions will be wiped out).
Add/Edit Resource
Plans: All
Navigation: Resource List (link:edit), Master & Foreign IDEs (link:name)
Path + name must be unique within a project; use '.' as a path separator; paths
are relative to the project's path (if any).
You can refactor a resource by renaming it and/or moving it (change its path).
The changes will propagate to each of its ResourceInstances (==> java .properties files)
- Resource Inheritance
Like traditional OO inheritance, promotes modularity and reuse
There is a limit of 5 direct super-resources; however, there is no limit to the
depth of the inheritance graph (equivalently, there is no limit to the size of the
graph). Inheritance order is relevant (in cases of multiple resources in the graph
containing the same key)
- Implementation
When doing a build (or preview source) and the build option generate inherited
is selected, j18n flattens out the inheritance graph, including the content of each
super-resource in the generated java .properties file, taking care to avoid duplicates.
The include order begins with the first super-resource and includes its entire
inheritance graph and then proceeds to the second super-resource and so on (depth-first traversal), e.g.
order
Resources would be included in the following order:
/ \
user project
/ \ |
common menu error
order -> user -> common -> menu -> project -> error