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

[ADD] prefer-env-translation: Add new check for odoo v18.0 #516

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

moylop260
Copy link
Collaborator

@moylop260 moylop260 commented Jan 13, 2025

Related to odoo/odoo#174844

The new way to translate is using self.env._() instead of _ method

But if there is not environment available in the code you can use LazyTranslate

from odoo. tools import LazyTranslate
_lt = LazyTranslate(__name__)

Based on #514

Closes #514

  • Consider LazyTranslate method _lt(...) for all the checkers similar to _(...) when self is not available

Related to odoo/odoo#174844

The new way to translate is using `self.env._()` instead of `_` method

But if there is not environment available in the code you can use LazyTranslate

```python
from odoo. tools import LazyTranslate
_lt = LazyTranslate(__name__)
```
@moylop260 moylop260 force-pushed the prefer-env-translation2 branch from 56c79d7 to c6bd479 Compare January 14, 2025 17:01
@moylop260 moylop260 merged commit 29c136b into OCA:main Jan 14, 2025
23 checks passed
@moylop260 moylop260 deleted the prefer-env-translation2 branch January 14, 2025 17:07
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

Successfully merging this pull request may close these issues.

3 participants