On 25 April 2010 11:36, Claudius Henrichs <claudiu...@gmx.de> wrote: > Am 25.04.2010 11:25, Alexander Sidorov: > > Hello! > > Is there any way to implement the following localization strategy: > 1. display russian (russian is just for example) name if it exists > 2. display english name if russian name doesn't exists > 3. display local name otherwise > > The problem for me is to determine which language is used for some region > by default. I have found this > discussion<http://wiki.openstreetmap.org/wiki/Talk:Proposed_features/Language_of_this_element>but > without solution. > > There's currently no way to determine what language the "name"-tag is in. > > Your question doesn't seem to be a tagging one though, because as I > understand you want to have different rendered outputs, correct? > Like John Smith explained this has to be done with some clever JOIN SQL > statements. > > Some further readings here [1] and an example of a rendering of the world > map in different languages here [2]. > > Claudius >
Part of the problem will be solved with the hstore patch I suspect. But else, John is pretty much right, the SQL can be interesting to write. I think a basic SQL statement would start like this. This is not real SQL code since I don't have the name of the table in mind. Also I am keeping in mind more of a simple osmosis schema for a just a russian extraction of name. This is not meant to be used to extract all countries in the world. If I was do that I would then use a slightly different approach: SELECT ( CASE WHEN nt1.v IS NOT NULL THEN nt1.v WHEN nt2.v IS NOT NULL THEN nt2.v ELSE nt.v END ) AS russianName FROM node_tags AS nt LEFT OUTER JOIN node_tags AS nt1 ON nt1.id = nt.id AND k = 'name:ru' LEFT OUTER JOIN node_tags AS nt2 ON nt2.id = nt.id AND k = 'name:en' WHERE nt.k = 'name' Here we go, we have a simple query to do as you asked. However, do keep mind that if the place is in Russia I wouldn't expect name:ru to actually exists since name should be containing the local name anyway. Of course, they are probably better way to do that. Among others things, creating a partial index on k = 'name:ru' and k = 'name:en' would speed up the query quite dramatically. The other approach would be to retrieve all name elements with a condition nt.k LIKE 'name%' and then perform a subquery on this afterwards. Similarly, creating a view with that information would prove quite useful. It is just down to imagination. Emilie Laffray
_______________________________________________ Tagging mailing list Tagging@openstreetmap.org http://lists.openstreetmap.org/listinfo/tagging