Merge branch 'feature/work-on-languages-workflow' into develop

This commit is contained in:
Andy Miller
2015-08-20 15:38:40 -06:00
3 changed files with 20 additions and 2 deletions

View File

@@ -21,7 +21,7 @@
"mrclay/minify": "~2.2",
"donatj/phpuseragentparser": "~0.3",
"pimple/pimple": "~3.0",
"rockettheme/toolbox": "1.0.*"
"rockettheme/toolbox": "1.1.*"
},
"autoload": {
"psr-4": {

View File

@@ -154,7 +154,11 @@ class Page
if (file_exists($path)) {
$aPage = new Page();
$aPage->init(new \SplFileInfo($path), $language .'.md');
$translatedLanguages[$language] = isset($aPage->header()->routes['default']) ? $aPage->header()->routes['default'] : $aPage->rawRoute();
$route = isset($aPage->header()->routes['default']) ? $aPage->header()->routes['default'] : $aPage->rawRoute();
if (!$route) $route = $aPage->slug();
$translatedLanguages[$language] = $route;
}
}

View File

@@ -437,4 +437,18 @@ abstract class Utils
}
return $result;
}
public static function pathPrefixedByLangCode($string)
{
$languages_enabled = self::getGrav()['config']->get('system.languages.supported', []);
if ($string[0] == '/' && $string[3] == '/' && in_array(substr($string, 1, 2), $languages_enabled)) {
return true;
}
return false;
}
}