| 241 |
/** |
/** |
| 242 |
* Function returns an array of the translatable languages that the Google interface supports |
* Function returns an array of the translatable languages that the Google interface supports |
| 243 |
*/ |
*/ |
| 244 |
function google_translation_languages($include = FALSE) { |
function google_translation_languages($include = FALSE, $original = FALSE) { |
| 245 |
$google_translations = array( |
$google_translations = array( |
| 246 |
'ar' => t('Arabic'), |
'ar' => t('Arabic'), |
| 247 |
'bg' => t('Bulgarian'), |
'bg' => t('Bulgarian'), |
| 267 |
'es' => t('Spanish'), |
'es' => t('Spanish'), |
| 268 |
'sv' => t('Swedish'), |
'sv' => t('Swedish'), |
| 269 |
); |
); |
| 270 |
|
// We only want the original with no further processing done |
| 271 |
|
if ($original === TRUE) { |
| 272 |
|
return $google_translations; |
| 273 |
|
} |
| 274 |
|
$locales = locale_language_list('name'); |
| 275 |
if ($include === TRUE) { |
if ($include === TRUE) { |
| 276 |
$mappings = variable_get('google_translation_language_mappings', array()); |
$mappings = variable_get('google_translation_language_mappings', array()); |
|
$locales = locale_language_list('name'); |
|
| 277 |
// We should now go through all of our mappings and add what we require so people can utilize the mapped fields |
// We should now go through all of our mappings and add what we require so people can utilize the mapped fields |
| 278 |
foreach ($mappings as $k => $v) { |
foreach ($mappings as $k => $v) { |
| 279 |
$google_translations[$k] = $locales[$k]; |
$google_translations[$k] = $locales[$k]; |
| 280 |
} |
} |
| 281 |
} |
} |
| 282 |
|
if (variable_get('google_translation_enabled_locales_only', false)) { |
| 283 |
|
foreach ($google_translations as $k => $v) { |
| 284 |
|
if (!isset($locales[$k])) { |
| 285 |
|
unset($google_translations[$k]); |
| 286 |
|
} |
| 287 |
|
} |
| 288 |
|
} |
| 289 |
return $google_translations; |
return $google_translations; |
| 290 |
} |
} |