Simplification with localisation

Hi @all!

Additionally to the localisation thread I want to “extend” your thoughts a bit, before the project starts. Maybe you can consider the following stuff for the admin resource bundles in order to clean up the project.

Within the admin there are several duplicated files that just differ with some text and some ids.

Example:
\modules\contentbox-admin\views\pages\editorSelector.cfm
\modules\contentbox-admin\views\entries\editorSelector.cfm
\modules\contentbox-admin\views\contentStore\editorSelector.cfm

All files contains the following code

`

×

Insert From ContentStore

#html.startForm(name="contentStoreEditorSelectorForm")#
#html.label(field="contentSearch",content="Quick Search:",class="inline")# #html.textField(name="contentSearch",size="30",class="textfield",value=rc.search)#
#renderView(view="contentStore/editorSelectorEntries", module="contentbox-admin")#

#html.endForm()#

Close
`

The marked text parts are the only differences in the files. Green are the ids and red the text changes.

So when adding localisation to the project I would recommend to have a resource bundle per module. Additionally to that it would be cool to have a chance to add optional resource files to views, layouts and handlers.
With them you could overwrite the default text.

eg: admin.editorSelector.title= "Content insert" (Defined in the global resource file a default title..``)
For the page view you would now like to have another title. So you need to define a new resource bundle for that view or handler. The key would be the same: admin.editorSelector.title= “Link To A ContentBox Page”

This would give you the change to reduce duplicated templates to a widget for example. The IDs (green marked) for html elements could be passed in…
The optional resource bundles would have a priority. So the last defined key would count. So it goes from “Module resource bundle”-> handler -> layout -> view

Within the admin it could be used to have predefined button values for creating, deleting and so on in the global resource file. This would be enough for most pages, but if some button values should be “friendlier” you could define a new resource set for the handler or view to overwrite these keys and return something like “Save this page” instead of just “save”.

Let me know what you think…
Cheers Andy

I don’t think the green ones, as they are used for JS and CSS selectors, and are not read by normal humans should not be localized in this example.

That’s correct. That’s why I ment to pass the prefix manually to the widget… just text would come from resources bundles

No need to go with a widget here, just an HTML helper would be sufficient.

Yes that is correct! - The main part is to have have a chance to overwrite the default resource bundles and then start to clean up internal stuff…

It would increase the reusability from “standard” html stuff with a chance to change text parts easily…

Good input. Luis and I talked at length yesterday about how to implement this. It is at the top of our ContentBox big feature list right now. We need to do some enhancements to the Resource Bundle plugin though to allow it to load multiple bundles. In theory, we would load the RB into memory and allow someone to override keys directly in memory.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Cool that you have this big feature on your list!

Overwriting would just make sense per request. If you want to use the default text everywhere, but not in one template just in that case you want to change the default RB returning the other text.

What I was thinking about is caching. To minimize Disk reads, on application load all files should be loaded and cached. Then you know for which view or handler you have RB stuff available and can merge the keys/ content on request for certain templates…

What do you think?

Thanks for the input.

Yes, we will be loading the translations to memory as it currently does upon init.

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano