From 422031770c3a60e47e72dbe9d143c8ac0c9275f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20D=C3=B6bertin?= Date: Tue, 17 Nov 2015 10:50:46 +0100 Subject: [PATCH 1/2] More compatible way of getting the current panel language --- selector.php | 14 +++++++++++--- template.php | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/selector.php b/selector.php index babb272..9dad0b5 100644 --- a/selector.php +++ b/selector.php @@ -2,7 +2,7 @@ /** * Selector. - * + * * Fileselect Field for Kirby 2 * * @version 1.5.0 @@ -143,9 +143,17 @@ class SelectorField extends BaseField */ public function __construct() { - // Load language files + // Build translation file path $baseDir = __DIR__ . DS . self::LANG_DIR . DS; - $lang = panel()->language(); + + // Get panel language + if (version_compare(panel()->version(), '2.2', '>=')) { + $lang = panel()->translation()->code(); + } else { + $lang = panel()->language(); + } + + // Load language files if (file_exists($baseDir . $lang . '.php')) { require $baseDir . $lang . '.php'; } else { diff --git a/template.php b/template.php index 35d60d4..9369159 100644 --- a/template.php +++ b/template.php @@ -8,7 +8,7 @@
type() == 'image'): ?>
- =')): ?> + version(), '2.2', '>=')): ?> 48, 'height' => 48, 'crop' => true)) ?> @@ -43,7 +43,7 @@