Skip to content

Instantly share code, notes, and snippets.

@rugk
Last active January 19, 2019 22:20
Show Gist options
  • Save rugk/f657628db4bf7fd59f8e5b19594e0854 to your computer and use it in GitHub Desktop.
Save rugk/f657628db4bf7fd59f8e5b19594e0854 to your computer and use it in GitHub Desktop.
OSM "level" translation in fluent with alternative versions when travelling in foreign countries
### input data: ground floor = level 0
### for OSM "level" tag, see https://wiki.openstreetmap.org/wiki/Key:level
### KNOWN BUGS:
### 1. I cannot remove the minus (-) sign from negative levels. See https://github.com/projectfluent/fluent/issues/228
### 2. I cannot properly calculate +1 for the US style. See https://github.com/projectfluent/fluent/issues/227
## SYNTAX: floor_<userlanguage>_<country-travelling-to>
## i.e. e.g. floor_DE_EUROP = German-speaking user travelling to Germany (or any other country with basement=level 0)
## Euopean user (e.g. German user)
# German/European country, German-speaking user
floor_DE_EUROP =
{ $level ->
[-2] im { $level }. Untergeschoss
[-1] im 1. Untergeschoss
[0] im Erdgeschoss
[one] im 1. Obergeschoss
*[other] im { $level }. Obergeschoss
}
# US style country, German-speaking user
# = German user travelling to US
floor_DE_USSTYLE =
{ $level ->
[-2] im Untergeschoss B{ $level }
[-1] Im Untergeschoss B(1)
[0] im Erdgeschoss
[one] im 1. Obergeschoss (2. Geschoss inklusive Erdgeschoss)
*[other] im { $level }. Geschoss ({ $level }+1. Geschoss inklusive Erdgeschoss)
}
## US user (i.e. US locale)
# US style, US user
floor_EN_USSTYLE =
{ $level ->
[-2] on basement floor B{ $level }
[-1] on basement floor B(1)
[0] on ground floor
[one] on floor 2
*[other] on floor { $level }+1
}
# German/European style, English-speaking user
# = US user travelling to Germany
floor_EN_EUROP =
{ $level ->
[-2] on basement floor { $level }
[-1] basement floor 1
[0] on ground floor
[one] on floor 2 (floor one without ground floor)
*[other] on floor { $level }+1 (floor { $level } without ground floor)
}
{
"locale": "en-US",
"dir": "ltr"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment