Last active
October 23, 2019 15:33
-
-
Save romaninsh/4e1fb008826d7855f8daf2f2e022af59 to your computer and use it in GitHub Desktop.
File placed in class namespace atk4/data/locale
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Automatically generated by lokalise.com for atk4\data (en) | |
namespace atk4\data\locale; | |
class En { | |
const language='en'; | |
const strings=[ | |
'Field requires array for defaults' => 'Field requires array for defaults', | |
'Field value can not be base64 encoded because it is not of string type' => 'Field value can not be base64 encoded because it is not of string type ({{field}})', | |
'Mandatory field value cannot be null' => 'Mandatory field value cannot be null ({{field}})', | |
'Model is already related to another persistence' => 'Model is already related to another persistence', | |
'Must not be null' => 'Must not be null', | |
'Test with plural' => [ | |
'zero' => 'Test zero', | |
'one' => 'Test is one', | |
'other' => 'Test are {{count}}', | |
], | |
'There was error while decoding JSON' => 'There was error while decoding JSON', | |
'Unable to determine persistence driver from DSN' => 'Unable to determine persistence driver from DSN', | |
'Unable to serialize field value on load' => 'Unable to serialize field value on load ({{field}})', | |
'Unable to serialize field value on save' => 'Unable to serialize field value on save ({{field}})', | |
'Unable to typecast field value on load' => 'Unable to typecast field value on load ({{field}})', | |
'Unable to typecast field value on save' => 'Unable to typecast field value on save ({{field}})', | |
]; | |
} |
The benefit of this format is that we do not to EXPLICITLY find and include the file. Composer
autoloader will do it for us. Therefore we do not need to manually search and pre-load all the strings. If one of the libraries relies on translations, then class will be loaded on-demand.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage - generic translator:
Usage - inside a framework (name-spaced)