-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] formio: Fix #3: language switcher buttons and translations in F…
…orm Builder and Forms. Convert the Odoo language code (underscore "_") to Formio JS/i18n expected IETF code (hyphen "-"). Concerns #91, #93.
- Loading branch information
Showing
8 changed files
with
46 additions
and
14 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
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
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 |
---|---|---|
|
@@ -14,3 +14,4 @@ | |
from . import formio_translation | ||
from . import ir_view | ||
from . import res_config_settings | ||
from . import res_lang |
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
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,18 @@ | ||
# Copyright Nova Code (http://www.novacode.nl) | ||
# See LICENSE file for full licensing details. | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class ResLang(models.Model): | ||
_inherit = 'res.lang' | ||
|
||
formio_ietf_code = fields.Char(compute='_compute_formio_ietf_code', string='IETF Code') | ||
|
||
def _compute_formio_ietf_code(self): | ||
for lang in self: | ||
lang.formio_ietf_code = self._formio_ietf_code(lang.code) | ||
|
||
@api.model | ||
def _formio_ietf_code(self, code): | ||
return code.replace('_', '-') |
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
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
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