[OSM-dev] extracting output text from api_controller
Tom Hughes
tom at compton.nu
Wed Jan 23 17:03:48 GMT 2008
In message <e04cd2420801230852i18105ce2t8fa85b167e429e0d at mail.gmail.com>
Xin Zheng <xin at zxv.ltd.uk> wrote:
> I am working on api_controller at the moment. I'd like to suggest we take
> out the output strings and put that in a YAML file.
>
> So rather than:
>
> unless bbox and bbox.count(',') == 3
> report_error("The parameter bbox is required, and must be of the form
> min_lon,min_lat,max_lon,max_lat")
> return
> end
>
> We can have:
> unless bbox and bbox.count(',') == 3
> report_error(TEXT['boundary_parameter_required']
> return
> end
>
> It separates logic from presentation.
>
> The yaml file can be /config/output_texts/en.yml.
>
> It is loaded from this intializer script:
> TEXT = YAML.load(File.read(RAILS_ROOT + "/config/text_outputs/en.yml"))
>
> Doing this will also be a step closer to having outputs in different
> languages.
>
> What does everyone think?
I think unless we have a full solution to the I18N problem there is
no point in wasting time on half measures which may need to be redone
when we settle on a final solution.
Present me with a solution that includes how to do I18N for the view
templates (without making them unreadable) as well as for the tiny
amount of text output directly by the controllers and I will be a very
happy bunny.
As it stands I think this is a waste of time.
Tom
--
Tom Hughes (tom at compton.nu)
http://www.compton.nu/
More information about the dev
mailing list