From 9f8b05914581173725b256157e15ee14c42d3865 Mon Sep 17 00:00:00 2001 From: oscarotero Date: Sat, 4 Mar 2017 17:39:13 +0100 Subject: [PATCH] added includeFunctions() method --- CHANGELOG.md | 4 +++- README.md | 0 src/BaseTranslator.php | 10 +++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) mode change 100755 => 100644 README.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f2cebfd..dd36bed5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,10 +9,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added * Added support for named placeholders (using `strtr`). For example: + ```php __('Hello :name', [':name' => 'World']); ``` * Added support for Twig v2 +* New function `BaseTranslator::includeFunctions()` to include the functions file without register any translator ### Fixed @@ -22,4 +24,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/). Previous releases are documented in [github releases](https://github.com/oscarotero/Gettext/releases) -[4.3.0]: https://github.com/oscarotero/Gettext/compare/v4.2.0...v4.3.0 \ No newline at end of file +[4.3.0]: https://github.com/oscarotero/Gettext/compare/v4.2.0...v4.3.0 diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/src/BaseTranslator.php b/src/BaseTranslator.php index b82d3cb8..302a22dc 100644 --- a/src/BaseTranslator.php +++ b/src/BaseTranslator.php @@ -24,8 +24,16 @@ public function register() self::$current = $this; - include_once __DIR__.'/translator_functions.php'; + static::includeFunctions(); return $previous; } + + /** + * Include the gettext functions + */ + public static function includeFunctions() + { + include_once __DIR__.'/translator_functions.php'; + } }