-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TA#66815 [MIG][16.0] lang_fr_activated (#141)
Co-authored-by: Majda EL MARIOULI <[email protected]>
- Loading branch information
1 parent
76e8bea
commit c977709
Showing
5 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
==================== | ||
Lang fr_FR Activated | ||
==================== | ||
This module loads the language fr_FR on installation. | ||
|
||
Context | ||
------- | ||
When installing Odoo, only en_US is loaded by default. | ||
|
||
In Canada, it is better to use fr_FR instead of fr_CA, because the latter one is more or less maintained. | ||
|
||
Requirement | ||
----------- | ||
Some modules (such as canada_mis_report) require to load fr_FR translations directly in python | ||
instead of a .po file. | ||
|
||
The language must therefore be loaded automatically before installing these modules. | ||
|
||
Contributors | ||
------------ | ||
* Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
|
||
More information | ||
---------------- | ||
* Meet us at https://bit.ly/numigi-com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from .init_hook import post_init_hook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
{ | ||
"name": "Lang fr_FR activated", | ||
"version": "16.0.1.0.0", | ||
"author": "Numigi", | ||
"maintainer": "Numigi", | ||
"license": "LGPL-3", | ||
"category": "Other", | ||
"summary": "Automatically activate the fr_FR language", | ||
"depends": [ | ||
"base", | ||
], | ||
"post_init_hook": "post_init_hook", | ||
"installable": True, | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from odoo import SUPERUSER_ID | ||
from odoo.api import Environment | ||
|
||
|
||
def post_init_hook(cr, _): | ||
env = Environment(cr, SUPERUSER_ID, {}) | ||
activate_fr_lang_if_inactive(env) | ||
|
||
|
||
def activate_fr_lang_if_inactive(env): | ||
lang = env.ref("base.lang_fr") | ||
if not lang.active: | ||
env["res.lang"]._activate_lang("fr_FR") |