Permalink
Browse files

*8660* Fall back on English ONIX codelist when localized version isn'…

…t available
  • Loading branch information...
asmecher committed Mar 11, 2015
1 parent b57500f commit ff7069bd9064b786ad23ab9467c6add15100ba4d
Showing with 13 additions and 3 deletions.
  1. +13 −3 classes/codelist/ONIXCodelistItemDAO.inc.php
@@ -119,11 +119,21 @@ function _cacheMiss($cache, $id) {
return null;
}
/**
* Get the filename for the ONIX codelist document. Use a localized
* version if available, but if not, fall back on the master locale.
* @param $locale string Locale code
* @return string Path and filename to ONIX codelist document
*/
function getFilename($locale) {
if (!AppLocale::isLocaleValid($locale)) {
$locale = AppLocale::MASTER_LOCALE;
$masterLocale = AppLocale::MASTER_LOCALE;
$localizedFile = "locale/$locale/ONIX_BookProduct_CodeLists.xsd";
if (AppLocale::isLocaleValid($locale) && file_exists($localizedFile)) {
return $localizedFile;
}
return "locale/$locale/ONIX_BookProduct_CodeLists.xsd";
// Fall back on the version for the master locale.
return "locale/$masterLocale/ONIX_BookProduct_CodeLists.xsd";
}
/**

0 comments on commit ff7069b

Please sign in to comment.