[locale] Accomodate more dodgy GeoIP providers

- Force spaces to _
 - Document the bits

FIXES #933
main
Adriaan de Groot 7 years ago
parent 3ef0fbe892
commit b4e4b691fd

@ -34,6 +34,7 @@ GeoIP::splitTZString( const QString& tz )
{
QString timezoneString( tz );
timezoneString.remove( '\\' );
timezoneString.replace( ' ', '_' );
QStringList tzParts = timezoneString.split( '/', QString::SkipEmptyParts );
if ( tzParts.size() >= 2 )

@ -50,7 +50,15 @@ public:
*/
virtual RegionZonePair processReply( const QByteArray& ) = 0;
/** @brief Splits a region/zone string into a pair. */
/** @brief Splits a region/zone string into a pair.
*
* Cleans up the string by removing backslashes (\\)
* since some providers return silly-escaped names. Replaces
* spaces with _ since some providers return human-readable names.
* Splits on the first / in the resulting string, or returns a
* pair of empty QStrings if it can't. (e.g. America/North Dakota/Beulah
* will return "America", "North_Dakota/Beulah").
*/
static RegionZonePair splitTZString( const QString& s );
protected:

@ -53,6 +53,11 @@ zone: "New_York"
# <Response><TimeZone>Europe/Brussels</TimeZone></Response>
# ```
#
# To accomodate providers of GeoIP timezone data with peculiar timezone
# naming conventions, the following cleanups are performed automatically:
# - backslashes are removed
# - spaces are replaced with _
#
#geoipUrl: "freegeoip.net"
# GeoIP style. Leave commented out for the "legacy" interpretation.

Loading…
Cancel
Save