Skip to content

Translations


Translate station names

Some transit providers offer services in multiple languages - one of which is the National Railway Company of Belgium (locally known as NMBS/SNCB, for Nationale Maatschappij der Belgische Spoorwegen in Dutch or Société nationale des chemins de fer belges in French). The company provides station names in multiple languages and are displayed depending on the user’s language and location settings.

The NMBS/SNCB publishes GTFS data in French as shown in the file below:

agency.txt

agency_id,agency_name,agency_url,agency_timezone,agency_lang
NMBS/SNCB,NMBS/SNCB,http://www.belgiantrain.be/,Europe/Brussels,fr

Since the agency language is set to French, the station names are listed in French in stops.txt.

stops.txt

stop_id,stop_code,stop_name,stop_desc,stop_lat,stop_lon,zone_id,stop_url,location_type,parent_station,platform_code
S8815040,,Bruxelles-Ouest,,50.8485600,4.32104000,,,1,,
S8821006,,Anvers-Central,,51.2172000,4.42109800,,,1,,

The file translations.txt is then used to translate the station names from the default agency language (French in this case) to Dutch.

translations.txt

table_name,field_name,record_id,language,translation
stops,stop_name,S8815040,nl,Brussel-West
  • In this example, the station names from stops.txt are translated, and records in stops.txt are identified by a stop_id. Therefore:
    • stops are listed under table names (in reference to stops.txt)
    • stop_name is listed under field_name (since the names of stations will be translated)
    • The stop_id for the station name to be translated from French is listed under record_id (in this case, the stop_id for Bruxelles-Ouest)
  • The name is translated to Dutch (nl)
  • Lastly, the translated name is listed under translation

There is another way to translate names in GTFS using the file translations.txt, where the field field_value is used instead of record_id. In this case, the station name is used to find the record to be translated from stops.txt.

translations.txt

table_name,field_name,field_value,language,translation`
stops,stop_name,Bruxelles-Ouest,nl,Brussel-West

Example source