Repository navigation
Description
Currently, POI category names are monolingual. Because of this, the user experience of applications targeting a global audience is bad, as they are often presented with categories lists written in languages they do not understand.
A multilingual category system would allow to automatically match the user's device or application locale. This would significantly increase the overall value of Mapsforge POI databases.
Currently, the poi_categories table handles category names as a flat, monolingual TEXT string. I think that multilingual categories can be implemented with no changes to the database schema and little changes on the 'reader' side by storing a serialized localization object as JSON text on poi_categories.name field.
More substantial changes will probably be needed on the POI writer side.
The serialized JSON text can look something like this:
{
"en": "Restaurant",
"es": "Restaurante",
"fr": "Restaurant",
"de": "Restaurant",
"it": "Ristorante"
}On AbstractPoiCategoryManager.java, this query SELECT * FROM poi_categories ORDER BY id will become:
SELECT
id,
coalesce(name ->> ?, name ->> ?) AS name,
parent
FROM
poi_categories
ORDER BY
idwhere the first parameter is the client app requested language (i.e fr) and the second one is the fallback one (i.e. en).
On metadata table, two rows must be added:
-
categories_default_language: the fallback language when a translation is missing. Database providers must ensure that translations into this language are present for all the records of thepoi_categoriestable.
There is no need to expose this value to client applications; it's for internal use only and must always be used as the second parameter of the above query. -
categories_available_languages: a comma separated list of all the language codes available in the database. This will allow applications to discover available languages.
Not all of the categories need to provide translations for all the languages. For example, provided thatenis thecategories_default_language,franddetranslations can be omitted from theJSONexample above because "Restaurant" is spelled the same way in English, French, and German.
Activity
[-]POI POI Multilingual categories[/-][+]POI multilingual categories[/+]devemux86 commentedon Sep 25, 2026
@Juanjo-MC Thanks for the suggestion,some quick thoughts:
We first need the 1st step that is the writer changes.
Then comes the 2nd step that is the reader changes.
Important: reader should be able to read old POI, like now.
We need all category names translated in popular languages (beyond the default English):
de, es, fr, it, nl
German, Spanish, French, Italian, Dutch
These translations must be stored somewhere, so poi-writer can read them and write them in the new poi files.
Probably stored in the poi-mapping.xml file.
We may need (?) a new version in the POI as there would be changes in the poi_categories table format.
devemux86 commentedon Sep 25, 2026
Reminder: if we make changes in the poi-mapping.xml format, then we need to also update the poi-mapping.xsd xml schema.
Juanjo-MC commentedon Sep 25, 2026
That's the natural place for them
Yes, we need a version bump here, because even though the database schema remains unchanged, the semantics of the
poi_categories.namefield are changingdevemux86 commentedon Sep 26, 2026
This is not needed, default language is English like now.
Better to be:
category_languagesThis should also be a new option in the map-writer command line.
Juanjo-MC commentedon Sep 26, 2026
Well, you are talking about your databases here ;-) We cannot assume that every POI database will use English as its default language, nor should we force database providers to use English everywhere.
Moreover, because of this requirement:
categories_default_languageshould not only be stored in the POI database; it should also be defined in poi-mapping.xml, so the POI writer knows which translation is mandatory when generating the database.Fine with me.
What exactly would this option control?
devemux86 commentedon Sep 26, 2026
We are talking about the category names.
Not the poi names that already exist in poi databases in all available OSM languages.
Category names must have the existing English language as default like now.
This feature request is to add extra translations for category names.
Poi writer must know from somewhere what category languages it should find in poi-mapping and store in poi files.
Anyway all these are just thoughts, someone must start working on the code and then we will see the real requirements.
Also all category names in poi-mapping.xml must be translated. 🙂
devemux86 commentedon Sep 26, 2026
Now I understand better what you mean; in that case, we probably need to set the default language as option.
Again this is for category names.
Then
category_default_languageandcategory_available_languagescould work.Juanjo-MC commentedon Sep 26, 2026
From a database of mine.
Again, we cannot assume that every POI database will use English as its default language, nor should we force database providers to use English everywhere.
Mapsforge POI format is flexible enough to accommodate data in any language and, by the way, from many data sources, not only OSM.
The data source for the database shown above is Spanish IGN.
Juanjo-MC commentedon Sep 26, 2026
More about this:
The example I provided in the first post is one possible use case; there are others.
Think, for example, about a POI database exclusively focused on shopping. One of the top categories would be:
{ "en": "Supermarkets", "fr": "Supermarchés", "es": "Supermercados" }and it's subcategories would be:
{ "en": "Carrefour" } { "en": "Lidl" } { "en": "Mercadona" }In this case we do not want to translate the brands.
So, the fact that not all categories should be translated into all available languages is not something that we may tolerate, is something that we want.
I say this, because when you say:
I get the impression that POI Writer would expect to find translations to those languages for every single category.
Is that the case?
devemux86 commentedon Sep 26, 2026
How does the
category_available_languagesget its values?Unless we define it in poi-mapping.xml, like the
category_default_language.Juanjo-MC commentedon Sep 26, 2026
On poi-mapping.xml, we can do something like this:
Language for
titleisdefault_language, English in this case.Note that there is no
frtranslation for 'Restaurants', as it spells the same as in EnglishPOI writer must maintain a list of available languages,
default_languagebeing at the top of it.When parsing the first category,
esanditwould be added to the list. When parsing the second one,frwould be added.At the end of the whole process, values in the list are written to
category_available_languagesResulting JSON category names would be:
{ "en": "Restaurants", "es": "Restaurantes", "it": "Ristoranti" } { "en": "Ice cream shops", "es": "Heladerías", "it": "Gelaterie", "fr": "Glaciers" }And
category_available_languageswould been,es,it,frdevemux86 commentedon Sep 27, 2026
How do you expect the
coalesceto work?There is a function to find a category by its title, used in poi writer and reader.
Such things must continue to work.
For example see the
PoiSearchViewerexample.7 remaining items
devemux86 commentedon Sep 29, 2026
@troNpo Thanks for the offer.
However, there is still nothing decided about the structure.
We must first start working on the code and finalize the structure, and then we can proceed with the translations.
troNpo commentedon Sep 29, 2026
Perfect, I will follow the thread in silence since I have no knowledge to contribute.
I will translations in a standard format that can be reused in the future when you have the process resolved.
I'll upload them here:
https://github.com/troNpo/Poi-multilanguage
In case it is useful
devemux86 commentedon Sep 29, 2026
@troNpo Thanks, but better wait and translate directly the poi-mapping.xml file.
Otherwise, someone would need to perform an excessive number of copy & paste operations.
Also the translations should be sorted for better management and future expansion:
de, es, fr, it, nl
Juanjo-MC commentedon Sep 29, 2026
Please, have a look here.
If OK for you I will submit a PR.
devemux86 commentedon Sep 30, 2026
Thanks, but these are 3 commits with minor changes that do not even compile.
(change to an interface without implementations)
A PR must include the complete feature, fully implemented and ready for production use.
devemux86 commentedon Sep 30, 2026
I started working on this.
Juanjo-MC commentedon Sep 30, 2026
I didn't implemented the interface because I wanted to discuss the implementation with you before.
How should we store the translations, as a string? As a map? Something else?
As I said on the Cruiser thread, by the time being, I have little to no spare time to implement this myself. Sorry
Thank you for this, much appreciated.
In my view, multilingual categories is the missing piece for Mapsforge POIs to be considered feature complete.
devemux86 commentedon Oct 8, 2026
I finished the POI v5 with multilingual categories.
It is currently in the
poibranch: https://github.com/mapsforge/mapsforge/tree/poi(only tables
poi_categoriesandmetadatawere changed)devemux86 commentedon Oct 8, 2026
@troNpo I see you translated the categories here. Very nice work! 👍
I updated the
poi-mapping.xmlwith all translations (fixing the formatting and adding some missing translations).If you make more changes, please use the latest
poi-mapping.xmlfrom here:https://github.com/mapsforge/mapsforge/blob/poi/mapsforge-poi-writer/src/main/config/poi-mapping.xml
Juanjo-MC commentedon Oct 8, 2026
poi-mapping.xml
@devemux86, @troNpo,
In the attached file, I have corrected some of the Spanish and French translations.
devemux86 commentedon Oct 8, 2026
@Juanjo-MC Thanks, I updated the poi-mappping.xml in the poi branch.
An updated example poi is here: andorra.poi.zip
devemux86 commentedon Oct 9, 2026
For reasons of clarity and management, it is best to have translations in all languages (as we do now),
regardless of whether some languages share the same translation with the default language.
devemux86 commentedon Oct 24, 2026
Implemented with #1823
POI v5 are available in Mapsforge server and mirror (fast).