mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
[core] Use hyphens instead of colons for address ranges
Signed-off-by: zyphlar <zyphlar@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
24a4edd904
commit
57e86d72e9
@@ -375,6 +375,17 @@ void GetReadableName(NameParamsIn const & in, NameParamsOut & out)
|
||||
GetReadableNameImpl(in, in.IsNativeOrSimilarLang(), out);
|
||||
}
|
||||
|
||||
string const GetReadableAddress(string const & address) {
|
||||
// Instead of housenumber range strings like 123:456, hyphenate like 123 - 456
|
||||
string out = address;
|
||||
size_t pos = 0;
|
||||
while ((pos = out.find(":", pos)) != string::npos) {
|
||||
out.replace(pos, 1, "\u2009\u2013\u2009"); // thin space + en-dash + thin space
|
||||
break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
int8_t GetNameForSearchOnBooking(RegionData const & regionData, StringUtf8Multilang const & src, string & name)
|
||||
{
|
||||
|
||||
@@ -121,6 +121,9 @@ namespace feature
|
||||
/// - country language name.
|
||||
void GetReadableName(NameParamsIn const & in, NameParamsOut & out);
|
||||
|
||||
/// Format house numbers etc to be more human-readable instead of using symbols like 123:456
|
||||
std::string const GetReadableAddress(std::string const & address);
|
||||
|
||||
/// Returns language id as return result and name for search on booking in the @name parameter,
|
||||
/// the priority is the following:
|
||||
/// - default name;
|
||||
|
||||
@@ -51,7 +51,7 @@ void Info::SetFromFeatureType(FeatureType & ft)
|
||||
bool emptyTitle = false;
|
||||
|
||||
m_primaryFeatureName = out.GetPrimary();
|
||||
m_uiAddress = m_address;
|
||||
m_uiAddress = feature::GetReadableAddress(m_address);
|
||||
|
||||
if (IsBookmark())
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "indexer/data_source.hpp"
|
||||
#include "indexer/feature_algo.hpp"
|
||||
#include "indexer/feature_data.hpp"
|
||||
#include "indexer/feature_utils.hpp"
|
||||
#include "indexer/ftypes_matcher.hpp"
|
||||
#include "indexer/road_shields_parser.hpp"
|
||||
#include "indexer/search_string_utils.hpp"
|
||||
@@ -304,7 +305,7 @@ ftypes::LocalityType GetLocalityIndex(feature::TypesHolder const & types)
|
||||
// TODO: Format street and house number according to local country's rules.
|
||||
string FormatStreetAndHouse(ReverseGeocoder::Address const & addr)
|
||||
{
|
||||
return addr.GetStreetName() + ", " + addr.GetHouseNumber();
|
||||
return addr.GetStreetName() + ", " + feature::GetReadableAddress(addr.GetHouseNumber());
|
||||
}
|
||||
|
||||
// TODO: Share common formatting code for search results and place page.
|
||||
@@ -512,7 +513,7 @@ private:
|
||||
{
|
||||
string streetName;
|
||||
m_ranker.GetBestMatchName(*streetFeature, streetName);
|
||||
name = streetName + ", " + addr.GetHouseNumber();
|
||||
name = streetName + ", " + feature::GetReadableAddress(addr.GetHouseNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user