Fixes in i18n
This commit is contained in:
parent
c65d47a5b4
commit
45cd953f8d
4 changed files with 27 additions and 4 deletions
|
|
@ -52,8 +52,9 @@ class I18n:
|
|||
return lang
|
||||
|
||||
@staticmethod
|
||||
def lang(module, symbol, text_default):
|
||||
def lang(module, symbol, text_default, lang=None):
|
||||
|
||||
if not lang:
|
||||
lang=I18n.get_default_lang()
|
||||
|
||||
I18n.l[lang]=I18n.l.get(lang, {})
|
||||
|
|
@ -81,3 +82,14 @@ class I18n:
|
|||
def get_browser_lang():
|
||||
|
||||
return request.headers.get('Accept-Language')
|
||||
|
||||
@staticmethod
|
||||
def lang_json(module, symbol, text_default):
|
||||
|
||||
arr_final={}
|
||||
|
||||
for l in I18n.dict_i18n:
|
||||
arr_final[l]=I18n.lang(module, symbol, text_default, l)
|
||||
|
||||
return json.dumps(arr_final)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ tinymce.init({
|
|||
height: 500,
|
||||
menubar: true,
|
||||
plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists textcolor wordcount imagetools contextmenu colorpicker textpattern',
|
||||
toolbar: 'formatselect | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat',
|
||||
toolbar: 'formatselect | fontsizeselect bold italic underline strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat',
|
||||
fontsize_formats: "8pt 10pt 12pt 14pt 18pt 24pt 36pt 48pt 64pt 100pt 120pt",
|
||||
content_css: '//www.tinymce.com/css/codepen.min.css',
|
||||
setup: function (editor) {
|
||||
editor.on('change', function () {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ class I18nField(PhangoField):
|
|||
|
||||
self.name_form=I18nForm
|
||||
self.extra_parameters=[form]
|
||||
self.show_formatted_value=True
|
||||
|
||||
def check_value(self, value):
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,10 @@ class PhangoField:
|
|||
|
||||
self.error_default='Error: field required'
|
||||
|
||||
# Show this value formatted
|
||||
|
||||
self.show_formatted_value=False
|
||||
|
||||
# This method is used for describe the new field in a sql language format.
|
||||
|
||||
|
||||
|
|
@ -749,6 +753,7 @@ class WebModel:
|
|||
|
||||
if self.show_formatted and row:
|
||||
for k, col in row.items():
|
||||
if self.fields[k].show_formatted_value:
|
||||
row[k]=self.fields[k].show_formatted(col)
|
||||
|
||||
results.append(row)
|
||||
|
|
@ -787,6 +792,10 @@ class WebModel:
|
|||
with self.select(fields_selected, raw_query) as cursor:
|
||||
for row in cursor:
|
||||
|
||||
if self.show_formatted and row:
|
||||
for k, col in row.items():
|
||||
row[k]=self.fields[k].show_formatted(col)
|
||||
|
||||
results[row[self.name_field_id]]=row
|
||||
|
||||
del_row_id(results)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue