Skip to content
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

Configuration for DbMessagesLoader #43

Closed
ninbarbu opened this issue Sep 24, 2019 · 3 comments
Closed

Configuration for DbMessagesLoader #43

ninbarbu opened this issue Sep 24, 2019 · 3 comments

Comments

@ninbarbu
Copy link

ninbarbu commented Sep 24, 2019

Hi,

I'm using cake 3.8.4 and I try to cofigure DbMessagesLoader.
I only have a single MVC to try it.
I did the Installation/Usage/DbMessagesLoader part of the documentation (including table creation).

I changed a line in the example :
I18n::setConfig('default', function ($domain, $locale) {
with
I18n::config('default', function ($domain, $locale) {
because I18n::setConfig doesn't exist in 3.8.4

The bootstrap section looks like this :

Cache::setConfig(Configure::consume('Cache'));
ConnectionManager::setConfig(Configure::consume('Datasources'));
TransportFactory::setConfig(Configure::consume('EmailTransport'));
Email::setConfig(Configure::consume('Email'));
Log::setConfig(Configure::consume('Log'));
Security::setSalt(Configure::consume('Security.salt'));

// Configure I18n to use DbMessagesLoader for default domain. You need to do
// this for each domain separately.
I18n::config('default', function ($domain, $locale) {
    return new \ADmad\I18n\I18n\DbMessagesLoader(
        $domain,
        $locale
    );
});

When I run the script bin/cake ADmad/I18n.i18n extract, the CLI seems right, but the table "i18n_messages" is not populated.

What did I miss ? Does it still work with cake 3.8.x ?

@ADmad
Copy link
Owner

ADmad commented Sep 24, 2019

If running bin/cake ADmad/I18n.i18n extract didn't throw any errors and the table was still not populated then I don't know what could be the issue.

Does your code have calls to i18n functions like __()?

@ninbarbu
Copy link
Author

ninbarbu commented Sep 24, 2019

Yes, I baked the views with CLI and every echo has __()
Here is the result of the keythe CLI

$ bin/cake ADmad/I18n.i18n extract
Current paths: None
What is the path you would like to extract?
[Q]uit [D]one
[C:\wamp64\www\paiement\src\] > C:\wamp64\www\paiement\src\

Current paths: C:\wamp64\www\paiement\src\
What is the path you would like to extract?
[Q]uit [D]one
[D] >

Would you like to extract the messages from the CakePHP core? (y/n)
[n] >

Would you like to merge all domain strings into the default domain? (y/n)
[n] >


Extracting...
---------------------------------------------------------------
Paths:
   C:\wamp64\www\paiement\src\
---------------------------------------------------------------
==========================================================================> 100%
Done.

When I simply extract the __() with bin/cake i18n extract, the src/Locale/default.pot is correctly generated.

@ADmad
Copy link
Owner

ADmad commented Jul 13, 2020

Hope you were able to figure out the problem. Closing as the issue has gone stable and there have been no other reports of similar problem.

@ADmad ADmad closed this as completed Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants