-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add i18n translate alias function to bootstrap #39
Conversation
https://github.com/kohana/core/blob/3.4/develop/classes/Kohana/I18n.php#L26 So I think it will work anyways if you have it before If the user will change the language in the bootstrap, the function will emit English (the default) translations only when it is used in If it is possible to put it before the modules, it would be better. Personally, I prefer the inconsistency of the languages over not being defined. Other opinions are welcome. |
The __() function doesn't need to be defined before Kohana::modules() in a hacky way anymore, this solves the problem: kohana/core#530. |
@@ -87,6 +87,15 @@ | |||
*/ | |||
I18n::lang('en-us'); | |||
|
|||
// Define i18n translate alias function | |||
if ( ! function_exists('__')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to wrap it with function_exists
? I know it does not hurt, but it's redundant since bootstraping is done only once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left it in because the index.php doesn't explicitly say that the bootstrap should only be included once https://github.com/kohana/kohana/blob/3.4/develop/index.php#L103 and there are existing checks for other globals https://github.com/kohana/kohana/blob/3.4/develop/index.php#L89.
@acoulton Yep, this also needs to be merged kohana/core#530 otherwise you'd get some more errors afterwards. |
Closes #39 Conflicts: application/bootstrap.php
@lenton thanks - actually the build runs OK (apart from issues related to the Kohana::modules() paths) without kohana/core#530. |
Related to kohana/core#526
When implementing I realised that I18n::lang() had to be set for the function to be useful, so in the end it did have to be placed after Kohana::modules().