[OSM-dev] extracting output text from api_controller

Xin Zheng xin at zxv.ltd.uk
Wed Jan 23 16:52:10 GMT 2008


Hi,
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?

Xin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20080123/e0806408/attachment.html>


More information about the dev mailing list