[OSM-dev] extracting output text from api_controller
Xin Zheng
xin at zxv.ltd.uk
Thu Jan 24 11:44:13 GMT 2008
John,
That's a great idea. The code will also be more usable.
I'm thinking of calling the module 'i18n.rb' which will go into /lib/.
The API call might look like: text_for(:node_limit_exceeded).
What do you think?
Xin
On 24/01/2008, John McKerrell <john at mckerrell.net> wrote:
>
> Xin,
>
> You could still store the information in a yaml file but access it using a
> function though couldn't you? One example of added functionality that we
> might want is to be able to fallback to a different language when we don't
> have a translation of some text, what do you think?
>
>
> John
>
> On 23 Jan 2008, at 17:49, Xin Zheng wrote:
>
> Cool. I'm glad we can agree on this.
>
> I'm working away at map method at the moment. I'll either apply the patch
> or code in the functionalities before end of this week.
>
>
> John,
> The reason it's in a hash it because Ruby can load a yaml file straight
> into it. A yaml file is basically a hash in file format. Imagine this in the
> file:
> en:
> this_text: "say something here"
> other_text: "say something else"
> cn:
> this_text: "i'd type in chinese if I could"
> other_text: "some more stuff"
>
>
> Ruby can then load all that into a hash to be easily used.
>
> On 23/01/2008, Tom Hughes <tom at compton.nu> wrote:
> >
> > In message < e04cd2420801230920t7eec23e6q4d21e298c38130a3 at mail.gmail.com
> > >
> > Xin Zheng <xin at zxv.ltd.uk> wrote:
> >
> > > My aim is to clean up the code so I can easily and safely add new
> > > functionality. Extracting the output string like this takes a step in
> > that
> > > direction.
> >
> > Clearly this is not bad as such, and it doesn't do any significant
> > damage beyond perhaps making certain types of edit to the code a bit
> > more of a pain, so if you really want to do it then fine. I just don't
> > think it's worth spending a lot of time on when there are better
> > things to do.
> >
> > If you want to do something useful to the map call then review the
> > patch at http://trac.openstreetmap.org/ticket/648 and consider
> > applying it, and see if you can tidy things up now that we have
> > the multi component key stuff - the version in amf_controller
> > looks quite a lot nicer than the main map call now ;-)
> >
> > With that I think I'm going to tune out for a few days and let you
> > three get on with whatever it is you're going to do and I'll look at
> > what you come up with next week or something rather than trying to
> > keep up in real time.
> >
> > Have fun, and try not to do too much damage guys!
> >
> > Tom
> >
> > --
> > Tom Hughes (tom at compton.nu)
> > http://www.compton.nu/
> >
> > _______________________________________________
> > dev mailing list
> > dev at openstreetmap.org
> > http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev
> >
>
>
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20080124/4591600c/attachment.html>
More information about the dev
mailing list