Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Multilingual views  (Read 6098 times)
Sammi
Courseware Beta
Full Member
***
Posts: 45


View Profile Email
« on: June 15, 2010, 02:43:49 »

Hi,

I am using my home brewed method for view localization.  It is simple and quite effective but I am still thinking of ways to simplify and thought I would get other people's opinion on a particular aspect of my method.

To simplify things I am not talking about the localization of the content - but interface elements like button labels and such.

Here is the flow right now:

1)  I have an XML document with all labels
2)  I have a Proxy that loads them and turns them into a smart vo
3)  The smart vo has a method to return a label identified by an id like SAVE or CLOSE
4)  My mediators collect the labels required for their views and pass them to the views as dictionaries
5)  The views use the dictionary to update all labels.

I have been thinking of skipping step 4 and 5 and just throw the whole smart vo to the views for simplicity.

The problem with that approach is that all the views get ALL the labels.  So even a simple view like "LogoutView" that only needs one label would get the vo with maybe 100 labels.

What do you think?  Maybe for an application that has only few views this is ok but what if the app has a lot of views?  Could/should I find a way to pass just a reference to the vo?

Best,
Sammi



« Last Edit: June 16, 2010, 06:59:47 by Sammi » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: June 16, 2010, 06:18:42 »

Yes. I hate view component localization by having to call some outside actor that is in charge of having the labels. Much better for it to be on the data carrier that holds the labels and can translate them on the spot. There's to stretch of responsibility there, and it guarantees all actors coming in contact with the label vo can get localized labels without having to consult another central actor.

-=Cliff>
Logged
Sammi
Courseware Beta
Full Member
***
Posts: 45


View Profile Email
« Reply #2 on: June 16, 2010, 07:04:51 »

Thanks,

so as long as I don't have hundreds of views and hundreds of labels I just pass the whole vo to the views.  It simplifies things and then if a view suddenly requires a new label I don't have to modify the mediator to pass that label.  The mediator just passes the vo with all the labels in the application.

Best,
Sammi
Logged
Pages: [1]
Print