Skip to content

Commit

Permalink
translated bearings; fixes #839
Browse files Browse the repository at this point in the history
  • Loading branch information
following5 committed Sep 8, 2015
1 parent e9f4aba commit 1ab03ba
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 41 deletions.
64 changes: 64 additions & 0 deletions htdocs/doc/sql/static-data/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2851,6 +2851,22 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2389', 'Luzern'
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2390', 'Neuchâtel', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2391', 'Lausanne', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2392', 'Zürich', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2500', 'north', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2501', 'north-northeast', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2502', 'northeast', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2503', 'east-northeast', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2504', 'east', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2505', 'east-southeast', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2506', 'southeast', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2507', 'south-southeast', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2508', 'south', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2509', 'south-southwest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2510', 'southwest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2511', 'west-southwest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2512', 'west', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2513', 'west-northwest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2514', 'northwest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2515', 'north-northwest', '2013-11-03 10:09:14');

-- Table sys_trans_ref
SET NAMES 'utf8';
Expand Down Expand Up @@ -7252,6 +7268,22 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2390', 'DE', 'Neuenburg', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2391', 'DE', 'Lausanne', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2392', 'DE', 'Zürich', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2500', 'DE', 'Nord', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2501', 'DE', 'Nord-Nordost', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2502', 'DE', 'Nordost', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2503', 'DE', 'Ost-Nordost', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2504', 'DE', 'Ost', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2505', 'DE', 'Ost-Südost', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2506', 'DE', 'Südost', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2507', 'DE', 'Süd-Südost', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2508', 'DE', 'Süd', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2509', 'DE', 'Süd-Südwest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2510', 'DE', 'Südwest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2511', 'DE', 'West-Südwest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2512', 'DE', 'West', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2513', 'DE', 'West-Nordwest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2514', 'DE', 'Nordwest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2515', 'DE', 'Nord-Nordwest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'EN', 'Reorder IDs', '2010-09-02 00:15:30');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2', 'EN', 'The database could not be reconnected.', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('3', 'EN', 'Testing – please do not login', '2010-08-28 11:48:07');
Expand Down Expand Up @@ -12640,6 +12672,22 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2390', 'FR', 'Neuchâtel', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2391', 'FR', 'Lausanne', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2392', 'FR', 'Zurich', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2500', 'FR', 'nord', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2501', 'FR', 'nord-nord-est', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2502', 'FR', 'nord-est', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2503', 'FR', 'est-nord-est', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2504', 'FR', 'est', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2505', 'FR', 'est-sud-est', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2506', 'FR', 'sud-est', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2507', 'FR', 'sud-sud-est', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2508', 'FR', 'sud', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2509', 'FR', 'sud-sud-ouest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2510', 'FR', 'sud-ouest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2511', 'FR', 'ouest-sud-ouest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2512', 'FR', 'ouest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2513', 'FR', 'ouest-nord-ouest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2514', 'FR', 'nord-ouest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2515', 'FR', 'nord-nord-ouest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'IT', 'Riordina gli ID', '2010-10-27 18:49:18');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2', 'IT', 'Impossibile riconnettersi al database', '2010-08-28 20:28:01');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('3', 'IT', 'Test - per favore non connettersi', '2010-08-28 20:36:53');
Expand Down Expand Up @@ -14457,6 +14505,22 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2390', 'IT', 'Neuchâtel', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2391', 'IT', 'Losanna', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2392', 'IT', 'Zurigo', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2500', 'IT', 'nord', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2501', 'IT', 'nord-nord-est', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2502', 'IT', 'nord-est', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2503', 'IT', 'est-nord-est', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2504', 'IT', 'est', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2505', 'IT', 'est-sud-est', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2506', 'IT', 'sud-est', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2507', 'IT', 'sud-sud-est', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2508', 'IT', 'sud', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2509', 'IT', 'sud-sud-ouest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2510', 'IT', 'sud-ovest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2511', 'IT', 'ovest-sud-ovest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2512', 'IT', 'ovest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2513', 'IT', 'ovest-nord-ovest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2514', 'IT', 'nord-ovest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2515', 'IT', 'nord-nord-ovest', '2013-11-03 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('922', 'JA', 'JA', '2011-05-15 16:04:51');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'NL', 'ID\'s opnieuw sorteren', '2011-02-04 19:49:56');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2', 'NL', 'De verbinding met de database kon niet hersteld worden.', '2011-02-04 19:49:56');
Expand Down
85 changes: 46 additions & 39 deletions htdocs/lib2/logic/geomath.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,87 +45,94 @@ static function calcBearing($lat1, $lon1, $lat2, $lon2)
}
}

static function Bearing2Text($parBearing, $parShortText = 0)
static function Bearing2Text($parBearing, $parShortText, $language)
{
global $opt, $translate;

if ($parShortText == 0)
{
if ($parBearing === false)
{
return 'N/A';
}
elseif (($parBearing < 11.25) || ($parBearing > 348.75))
return 'Nord';
$bearing = 'north';
elseif ($parBearing < 33.75)
return 'Nord/Nordost';
$bearing = 'north-northeast';
elseif ($parBearing < 56.25)
return 'Nordost';
$bearing = 'northeast';
elseif ($parBearing < 78.75)
return 'Ost/Nordost';
$bearing = 'east-northeast';
elseif ($parBearing < 101.25)
return 'Ost';
$bearing = 'east';
elseif ($parBearing < 123.75)
return 'Ost/Südost';
$bearing = 'east-southeast';
elseif ($parBearing < 146.25)
return 'Südost';
$bearing = 'southeast';
elseif ($parBearing < 168.75)
return 'Süd/Südost';
$bearing = 'south-southeast';
elseif ($parBearing < 191.25)
return 'Süd';
$bearing = 'south';
elseif ($parBearing < 213.75)
return 'Süd/Südwest';
$bearing = 'south-southwest';
elseif ($parBearing < 236.25)
return 'Südwest';
$bearing = 'southwest';
elseif ($parBearing < 258.75)
return 'West/Südwest';
$bearing = 'west-southwest';
elseif ($parBearing < 281.25)
return 'West';
$bearing = 'west';
elseif ($parBearing < 303.75)
return 'West/Nordwest';
$bearing = 'west-northwest';
elseif ($parBearing < 326.25)
return 'Nordwest';
$bearing = 'northwest';
elseif ($parBearing <= 348.75)
return 'Nord/Nordwest';
else return 'N/A';
$bearing = 'north-northwest';
else
return 'N/A';
return $translate->t($bearing, '', '', 0, '', 1, $language);
}
else
{
if ($parBearing === false)
{
return 'N/A';
}
elseif (($parBearing < 11.25) || ($parBearing > 348.75))
return 'N';
$bearing = 'N';
elseif ($parBearing < 33.75)
return 'NNO';
$bearing = 'NNE';
elseif ($parBearing < 56.25)
return 'NO';
$bearing = 'NE';
elseif ($parBearing < 78.75)
return 'ONO';
$bearing = 'ENE';
elseif ($parBearing < 101.25)
return 'O';
$bearing = 'E';
elseif ($parBearing < 123.75)
return 'OSO';
$bearing = 'ESE';
elseif ($parBearing < 146.25)
return 'SO';
$bearing = 'SE';
elseif ($parBearing < 168.75)
return 'SSO';
$bearing = 'SSE';
elseif ($parBearing < 191.25)
return 'S';
$bearing = 'S';
elseif ($parBearing < 213.75)
return 'SSW';
$bearing = 'SSW';
elseif ($parBearing < 236.25)
return 'SW';
$bearing = 'SW';
elseif ($parBearing < 258.75)
return 'WSW';
$bearing = 'WSW';
elseif ($parBearing < 281.25)
return 'W';
$bearing = 'W';
elseif ($parBearing < 303.75)
return 'WNW';
$bearing = 'WNW';
elseif ($parBearing < 326.25)
return 'NW';
$bearing = 'NW';
elseif ($parBearing <= 348.75)
return 'NNW';
else return 'N/A';
$bearing = 'NNW';
else
return 'N/A';
$tb = '';
for ($i=0; $i<strlen($bearing); ++$i)
$tb .= $translate->t($bearing[$i], '', '', 0, '', 1, $language);
// Translation of N S W E does not work, for whatever reason.
// But this is currently not in use.
return $tb;
}
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/lib2/search/search.html.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function search_output()
{
$direction = geomath::calcBearing($lat_rad / 3.14159 * 180, $lon_rad / 3.14159 * 180, $rCache['latitude'], $rCache['longitude']);
$rCache['direction_deg'] = round($direction / 22.5) * 22.5;
$rCache['direction_txt'] = geomath::Bearing2Text($direction, 1);
$rCache['direction_txt'] = geomath::Bearing2Text($direction, 0, $opt['template']['locale']);
}
else
$rCache['direction_deg'] = false;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/util/notification/run_notify.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function process_new_cache($notify)
$mailbody = mb_ereg_replace('{cachename}', $notify['cachename'], $mailbody);
$mailbody = mb_ereg_replace('{distance}', round(geomath::calcDistance($notify['lat1'], $notify['lon1'], $notify['lat2'], $notify['lon2'], 1), 1), $mailbody);
$mailbody = mb_ereg_replace('{unit}', 'km', $mailbody);
$mailbody = mb_ereg_replace('{bearing}', geomath::Bearing2Text(geomath::calcBearing($notify['lat1'], $notify['lon1'], $notify['lat2'], $notify['lon2'])), $mailbody);
$mailbody = mb_ereg_replace('{bearing}', geomath::Bearing2Text(geomath::calcBearing($notify['lat1'], $notify['lon1'], $notify['lat2'], $notify['lon2']), 0, $notify['recp_lang']), $mailbody);
$mailbody = mb_ereg_replace('{cachetype}', get_cachetype_name($notify['cachetype'], $notify['recp_lang']), $mailbody);
$mailbody = mb_ereg_replace('{cachesize}', get_cachesize_name($notify['cachesize'], $notify['recp_lang']), $mailbody);
$mailbody = mb_ereg_replace('{oconly-}', $notify['oconly'] ? $translate->t('OConly-', '', basename(__FILE__), __LINE__, '', 1, $notify['recp_lang']) : '', $mailbody);
Expand Down

0 comments on commit 1ab03ba

Please sign in to comment.