mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
Updated and restructured library documentation to include Locale changes
Updated Getting Started Docs Added documentation for Result Handling removed api documentation
This commit is contained in:
@@ -268,13 +268,17 @@ name out of it:
|
|||||||
'Brugges'
|
'Brugges'
|
||||||
```
|
```
|
||||||
|
|
||||||
The `address_row` field has a helper function to apply the function to all
|
The `address_row` field has a helper function to compute the display name for each Address Line
|
||||||
its members and save the result in the `local_name` field. It also returns
|
component based on its `local_name` field. This is then utilized by the overall `result` object,
|
||||||
all the localized names as a convenient simple list. This list can be used
|
which has a helper function to apply the function to all its ‘address_row’ members and saves
|
||||||
to create a human-readable output:
|
the result in the `locale_name` field.
|
||||||
|
|
||||||
|
However, in order to set this `local_name` field in a preferred language, you must use the `Locale`
|
||||||
|
object which contains the function `localize_results`, which explicitly sets each `local_name field`.
|
||||||
|
|
||||||
``` python
|
``` python
|
||||||
>>> address_parts = results[0].address_rows.localize(locale)
|
>>> Locales().localize_results(results)
|
||||||
|
>>> address_parts = results[0].address_rows
|
||||||
>>> print(', '.join(address_parts))
|
>>> print(', '.join(address_parts))
|
||||||
Bruges, Flandre-Occidentale, Flandre, Belgique
|
Bruges, Flandre-Occidentale, Flandre, Belgique
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -49,7 +49,11 @@ its address.
|
|||||||
|
|
||||||
## Localization
|
## Localization
|
||||||
|
|
||||||
Results are always returned with the full list of available names.
|
Results are always returned with the full list of available names. However, the
|
||||||
|
default `locale_name` must be explicitly set using the `localize` function within
|
||||||
|
`Locales`. This parses through the full list of available names to find the one
|
||||||
|
most preferred by the user. Once this is set, the user can simply use the
|
||||||
|
`display_name` field within a `Result` object to retrive the localized name.
|
||||||
|
|
||||||
### Locale
|
### Locale
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user