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

TA#66815 [MIG][16.0] lang_fr_activated #141

Merged
merged 2 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .docker_files/main/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"summary": "Install all addons required for testing.",
"depends": [
"base",
"lang_fr_activated",
"mail",
"mail_bot_no_pong",
"mail_notification_no_action_button",
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN gitoo install-all --conf_file /gitoo.yml --destination "${THIRD_PARTY_ADDONS

USER odoo

COPY lang_fr_activated /mnt/extra-addons/lang_fr_activated
COPY mail_bot_no_pong /mnt/extra-addons/mail_bot_no_pong
COPY mail_notification_no_action_button /mnt/extra-addons/mail_notification_no_action_button
COPY mail_template_default /mnt/extra-addons/mail_template_default
Expand Down
25 changes: 25 additions & 0 deletions lang_fr_activated/README.rst
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
4 changes: 4 additions & 0 deletions lang_fr_activated/__init__.py
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

Check notice on line 4 in lang_fr_activated/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lang_fr_activated/__init__.py#L4

'.init_hook.post_init_hook' imported but unused (F401)
17 changes: 17 additions & 0 deletions lang_fr_activated/__manifest__.py
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).

{

Check warning on line 4 in lang_fr_activated/__manifest__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lang_fr_activated/__manifest__.py#L4

Statement seems to have no effect
"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,
}
Binary file added lang_fr_activated/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions lang_fr_activated/init_hook.py
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")
Loading