From 840461499faabc0587f933e89e46bca5d0f9f634 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Thu, 24 Sep 2015 09:27:47 +0930 Subject: [PATCH] Temporary solution to resolve translation references Just implemented this roughly so I can keep working :D /cc @franzliedke --- framework/core/src/Locale/TranslationCompiler.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/framework/core/src/Locale/TranslationCompiler.php b/framework/core/src/Locale/TranslationCompiler.php index 1ff0a5a08..1c96f76b1 100644 --- a/framework/core/src/Locale/TranslationCompiler.php +++ b/framework/core/src/Locale/TranslationCompiler.php @@ -34,6 +34,14 @@ class TranslationCompiler $translations = array_replace_recursive($translations, Yaml::parse(file_get_contents($filename))); } + // Temporary solution to resolve references. + // TODO: Make it do more than one level deep, unit test. + array_walk_recursive($translations, function (&$value, $key) use ($translations) { + if (preg_match('/^=>\s*([a-z0-9_\.]+)$/i', $value, $matches)) { + $value = array_get($translations, $matches[1]); + } + }); + return $translations; } }