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

yii message command do not extract messages from "\Yii::t(" with leading symbol \ #18941

Closed
epifrin opened this issue Oct 8, 2021 · 6 comments
Labels
Milestone

Comments

@epifrin
Copy link
Contributor

epifrin commented Oct 8, 2021

Translations won't be collected from construction \Yii::t('app', 'test'); if it has leading symbol \ and Yii do not imported in use section.

Additional info

Q A
Yii version 2.0.43
PHP version 8
Operating system
@bizley bizley added the status:to be verified Needs to be reproduced and validated. label Oct 8, 2021
@WinterSilence
Copy link
Contributor

MessageController:

/**
 * @var string the name of the function for translating messages.
 * Defaults to 'Yii::t'. This is used as a mark to find the messages to be
 * translated. You may use a string for single function name or an array for
 * multiple function names.
 */
public $translator = 'Yii::t';

@samdark
Copy link
Member

samdark commented Oct 19, 2021

@epifrin please try customizing the option.

@samdark
Copy link
Member

samdark commented Nov 2, 2021

Now it's fixed in master branch.

@MarkoNV
Copy link
Contributor

MarkoNV commented Oct 14, 2022

Since creating config file via console command put
'translator' => ['Yii::t', '\Yii::t'],
in config of older projects, shouldn't this be mentioned in UPGRADE.md?

@WinterSilence
Copy link
Contributor

WinterSilence commented Oct 14, 2022

@MarkoNV PR not change behavior of older projects, but you can update UPGRADE.md - this may be useful

@MarkoNV
Copy link
Contributor

MarkoNV commented Oct 14, 2022

@WinterSilence it doesn't change behaviour of older projects, but since that behaviour is bug and this is bugfix for that bug, action that need to be taken on project level for bugfix to work, should be mentioned.

I'll try to make PR next week. I tried today for other bug, but on Win machine couldn't make configuration right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants