translate 'adm1' country names

This commit is contained in:
following
2013-03-26 22:45:13 +01:00
parent 0fa896026a
commit a6a95e2d4b
3 changed files with 22 additions and 11 deletions

View File

@ -99,19 +99,21 @@
`caches`.`cache_id` `cache_id`,
`caches`.`name` `name`,
`caches`.`date_hidden`,
`cache_location`.`adm1`,
IFNULL(`sys_trans_text`.`text`,`cache_location`.`adm1`) AS `adm1`,
`cache_location`.`adm2`,
`cache_location`.`adm3`,
`cache_location`.`adm4`
FROM `caches`
INNER JOIN `user` ON `user`.`user_id`=`caches`.`user_id`
LEFT JOIN `cache_location` ON `caches`.`cache_id`=`cache_location`.`cache_id`
LEFT JOIN `countries` ON `countries`.`short`=`cache_location`.`code1`
LEFT JOIN `sys_trans_text` ON `sys_trans_text`.`trans_id`=`countries`.`trans_id` AND `sys_trans_text`.`lang`='&2'
WHERE `caches`.`country`='&1' AND
`caches`.`date_hidden` >= curdate() AND
`caches`.`type` = 6 AND
`caches`.`status`=1
ORDER BY `date_hidden` ASC LIMIT 0, 10",
$sUserCountry);
$sUserCountry, $opt['template']['locale']);
$tpl->assign_rs('events', $rs);
sql_free_result($rs);
@ -122,18 +124,20 @@
`caches`.`name` `name`,
`caches`.`date_created` `date_created`,
`caches`.`type`,
`cache_location`.`adm1`,
IFNULL(`sys_trans_text`.`text`,`cache_location`.`adm1`) AS `adm1`,
`cache_location`.`adm2`,
`cache_location`.`adm3`,
`cache_location`.`adm4`
FROM `caches`
INNER JOIN `user` ON `user`.`user_id`=`caches`.`user_id`
LEFT JOIN `cache_location` ON `caches`.`cache_id`=`cache_location`.`cache_id`
LEFT JOIN `countries` ON `countries`.`short`=`cache_location`.`code1`
LEFT JOIN `sys_trans_text` ON `sys_trans_text`.`trans_id`=`countries`.`trans_id` AND `sys_trans_text`.`lang`='&2'
WHERE `caches`.`country`='&1' AND
`caches`.`type` != 6 AND
`caches`.`status` = 1
ORDER BY `caches`.`date_created` DESC LIMIT 0, 10",
$sUserCountry);
$sUserCountry, $opt['template']['locale']);
$tpl->assign_rs('newcaches', $rs);
sql_free_result($rs);
@ -149,7 +153,7 @@
`caches`.`cache_id` AS `cache_id`,
`caches`.`name` AS `name`,
`caches`.`type`,
`cache_location`.`adm1`,
IFNULL(`sys_trans_text`.`text`,`cache_location`.`adm1`) AS `adm1`,
`cache_location`.`adm2`,
`cache_location`.`adm3`,
`cache_location`.`adm4`
@ -157,6 +161,8 @@
INNER JOIN `caches` ON `caches`.`cache_id`=`cache_rating`.`cache_id`
INNER JOIN `user` ON `user`.`user_id`=`caches`.`user_id`
LEFT JOIN `cache_location` ON `cache_rating`.`cache_id`=`cache_location`.`cache_id`
LEFT JOIN `countries` ON `countries`.`short`=`cache_location`.`code1`
LEFT JOIN `sys_trans_text` ON `sys_trans_text`.`trans_id`=`countries`.`trans_id` AND `sys_trans_text`.`lang`='&2'
WHERE `caches`.`country`='&1' AND
`cache_rating`.`rating_date`>DATE_SUB(NOW(), INTERVAL 30 DAY) AND
`caches`.`type`!=6 AND
@ -166,7 +172,7 @@
`dLastLog` DESC,
`cache_id` DESC
LIMIT 0, 10",
$sUserCountry);
$sUserCountry, $opt['template']['locale']);
$tpl->assign_rs('topratings', $rs);
sql_free_result($rs);

View File

@ -16,18 +16,21 @@
if (!$tpl->is_cached())
{
$rs = sql("SELECT `cache_location`.`adm1`, `cache_location`.`adm3`,
$rs = sql("SELECT IFNULL(`sys_trans_text`.`text`,`cache_location`.`adm1`) AS `adm1`,
`cache_location`.`adm3`,
`rating_tops`.`rating` AS `idx`, `stat_caches`.`toprating` AS `ratings`, `stat_caches`.`found` AS `founds`,
`caches`.`name`, `caches`.`wp_oc` AS `wpoc`, `user`.`username`, `user`.`user_id` AS `userid`
FROM `rating_tops`
INNER JOIN `caches` ON `rating_tops`.`cache_id`=`caches`.`cache_id`
INNER JOIN `cache_location` ON `rating_tops`.`cache_id`=`cache_location`.`cache_id`
LEFT JOIN `countries` ON `countries`.`short`=`cache_location`.`code1`
LEFT JOIN `sys_trans_text` ON `sys_trans_text`.`trans_id`=`countries`.`trans_id` AND `sys_trans_text`.`lang`='&1'
INNER JOIN `stat_caches` ON `rating_tops`.`cache_id`=`stat_caches`.`cache_id`
INNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id`
ORDER BY `cache_location`.`adm1` ASC,
`cache_location`.`adm3` ASC,
`rating_tops`.`rating` DESC,
`caches`.`name` ASC");
`caches`.`name` ASC", $opt['template']['locale']);
$tpl->assign_rs('tops', $rs);
sql_free_result($rs);
}

View File

@ -97,7 +97,7 @@ function getChildWaypoints($cacheid)
`caches`.`search_time` AS `searchtime`,
`caches`.`way_length` AS `waylength`,
`caches`.`country` AS `countryCode`,
IFNULL(`ttCountry`.`text`, `countries`.`name`) AS `country`,
IFNULL(`ttCountry`.`text`, `countries`.`name`) AS `country`,
`caches`.`logpw` AS `logpw`,
`caches`.`date_hidden` AS `datehidden`,
`caches`.`wp_oc` AS `wpoc`,
@ -124,7 +124,7 @@ function getChildWaypoints($cacheid)
IFNULL(`cache_visits`.`count`, 0) AS `visits`,
`user`.`username` AS `username`,
IFNULL(`cache_location`.`code1`, '') AS `code1`,
IFNULL(`cache_location`.`adm1`, '') AS `adm1`,
IFNULL(`trans2`.`text`, IFNULL(`cache_location`.`adm1`,'')) AS `adm1`,
IFNULL(`cache_location`.`adm2`, '') AS `adm2`,
IFNULL(`cache_location`.`adm3`, '') AS `adm3`,
IFNULL(`cache_location`.`adm4`, '') AS `adm4`
@ -132,12 +132,14 @@ function getChildWaypoints($cacheid)
INNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id`
INNER JOIN `cache_desc` ON `caches`.`cache_id`=`cache_desc`.`cache_id` AND `cache_desc`.`language`=PREFERED_LANG(`caches`.`desc_languages`, '&3')
INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`
LEFT JOIN `cache_location` ON `caches`.`cache_id` = `cache_location`.`cache_id`
LEFT JOIN `countries` ON `caches`.`country`=`countries`.`short`
LEFT JOIN `sys_trans` AS `tCountry` ON `countries`.`trans_id`=`tCountry`.`id` AND `countries`.`name`=`tCountry`.`text`
LEFT JOIN `sys_trans_text` AS `ttCountry` ON `tCountry`.`id`=`ttCountry`.`trans_id` AND `ttCountry`.`lang`='&2'
LEFT JOIN `countries` `c2` ON `c2`.`short`=`cache_location`.`code1`
LEFT JOIN `sys_trans_text` `trans2` ON `trans2`.`trans_id`=`c2`.`trans_id` AND `trans2`.`lang`='&2'
LEFT JOIN `cache_visits` ON `cache_visits`.`cache_id`=`caches`.`cache_id` AND `user_id_ip`='0'
LEFT JOIN `stat_caches` ON `caches`.`cache_id`=`stat_caches`.`cache_id`
LEFT JOIN `cache_location` ON `caches`.`cache_id` = `cache_location`.`cache_id`
WHERE `caches`.`cache_id`='&1'", $cacheid, $opt['template']['locale'], $sPreferedDescLang, $login->userid);
$rCache = sql_fetch_assoc($rs);
sql_free_result($rs);