-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
Support l10n in config files #300
Comments
Is this the result of a cached config? |
@QWp6t cached and not cached. |
I used this on a multisite with acorn v2 and parent/child themes that had similar issues, maybe it’s useful https://gist.github.com/oxyc/d5f62c41b6ed87f743d33c1b3c5a5c30 |
Hi @oxyc |
So 6 months later I updated acorn :) In @@ -40,7 +40,12 @@ if (! function_exists('\Roots\bootloader')) {
);
}
-\Roots\bootloader()->boot();
+$bootloader = \Roots\bootloader();
+$bootloader->getApplication()->bind(
+ \Roots\Acorn\Bootstrap\LoadConfiguration::class,
+ \App\Bootstrap\LoadConfiguration::class
+);
+$bootloader->boot();
/* Add added this to <?php
namespace App\Bootstrap;
use Illuminate\Contracts\Foundation\Application;
use Roots\Acorn\Bootstrap\LoadConfiguration as AcornLoadConfiguration;
class LoadConfiguration extends AcornLoadConfiguration
{
/**
* {@inheritdoc}
*/
public function bootstrap(Application $app)
{
parent::bootstrap($app);
// When `wp acorn optimize` runs it will create a cached config.php file
// with pre-determined values at build times. This causes issues with
// multisite since the config.php file uses get_theme_file_path() which
// needs to be dynamically evaluated per site.
// Here we override the cached config by re-evaluating the config files.
$this->loadConfigurationFiles($app, $app->make('config'));
}
} The context for this was parent/child theme having cached theme paths but same should apply to l10n. |
Any update on fixing this? I get translations to work as normal in WordPress but then suddenly they stop working. I try some combination of |
All the updates so far are in this issue — there has not yet been a PR submitted to address this in Acorn Did you try the solution from the comment above you? |
Sorry if I hijacked the issue. I tried the solutions but they did not work for me. My problem seems to be with |
Version
3.2.0
What did you expect to happen?
Using
__()
in config files registers the strings for gettext and$this->app->config->get()
gets the config with the translated strings.What actually happens?
$this->app->config->get()
/config()
gets the original strings and not the translation.Also please see this issue for Poet.
Steps to reproduce
Add a string with
__()
to any config file, translate it and get the config withconfig()
.System info
No response
Log output
No response
Please confirm this isn't a support request.
Yes
The text was updated successfully, but these errors were encountered: