mirror of
https://github.com/getgrav/grav.git
synced 2026-07-07 09:41:33 +02:00
Merge branch 'feature/work-on-languages-workflow' into develop
This commit is contained in:
@@ -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": {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user