Introduction
United Nations
UN being an international organization has a strong reason to have Indico pretty much fully translated to UN official languages.
- Arabic, Chinese, English, French, Russian and Spanish.
- Soon Indico.UN will be open for many UN regional duty stations in different parts of the world.
i18n Translation
We are already able to translate every static text of Indico i.e.
- WTForm Labels, description
- Labels of Buttons
- Instructions of Human Activities such as tooltip
(title)
- Text in Links’ URL
- Messages displayed to the end-user that are embedded in the application (validation messages, widgets’ confirmation, and other messages)
- Text literals found in all types of expressions (including Unescaped Expressions and JavaScript)
Our requirement
- Translated titles majorly Categories and Events
- Translated list choices/options of the dropdown widgets such as countries or any other table, if directly being populated from the Database. (probably, this will be done on UN plugin)
Indico Core models -
Model | columns |
---|---|
Category | title, description |
Event | title, description, contact_title |
RegistrationForm | title, description |
- ARABIC: Page layout compliant with the script writing direction (Left to right or right to left) (CSS)
Its Complicated, is it?
We recognise that user data translation adds complexity, and we understand that you, as the Indico core team, are not yet ready to pursue this.
As a result, we tried something similar to TranslationHybrid and have a draft PR on our GitHub repository. We believe that simply adding a Mutable JSONB
blob column and replacing the String
column with hybrid_property
adds no further complexity and is easily maintainable.
- We don’t need to change any WTForm, Templates, etc.
- We don’t need to change most of our sqlalchemy queries.
- If the title is edited from the form, then the value is placed with current session’s language i.e key-value pair. (setter of TranslationHybrid)
Mystery begins
- The
query.options(load_only('title'))
Most of the Indico Core’s queries on Category and Event involve load only, For example:
_category_query_options = (joinedload('children').load_only('id', 'title_translations', 'protection_mode'),
undefer('attachment_count'), undefer('has_events'))
_event_query_options = (joinedload('person_links'), joinedload('series'), undefer_group('series'),
joinedload('label'),
load_only('id', 'category_id', 'created_dt', 'start_dt', 'end_dt', 'timezone',
'protection_mode', 'title_translations', 'type_', 'series_pos', 'series_count',
'own_address', 'own_venue_id', 'own_venue_name', 'label_id', 'label_message',
'visibility'))
- Notice I changed
title
totitle_translations
- We are not yet able to think of a cleaner way to patch or change these queries to replace
title
withtitle_translations
- if we rename the column
title
instead oftitle_translations
then, all the other queries would fail. - Also, if we rename the hybrid property we will have to patch WTFORMS, controllers, and templates.
Open for discussions
We would be grateful, If the Indico.core team can assist us in finding a solution. We are open to discuss these and schedule a developers-only meeting to find a common solution.
Thanks in advance
Vasant Vohra
Indico.UN Team