Closed tdipisa closed 6 years ago
Strings not localized (not working):
I've investigated it a bit and found out that we should have at least one plugin named the same as extension in order to have translations working. There's setup.cfg
file, which controls paths to generated files, but it's not used during runtime, where .mo path calculation in gettext uses plugin's .name
attribute, so we have something like ckanext/status_reports/i18n/<lang>/LC_MESSAGES/ckanext-status_reports.mo
as a resulting path (which is obviously wrong). I've changed plugin name from status_reports
to gsreport
, and now translations work.
actually it looks like overriding ITranslation.18n_domain()
should do the trick.
Dataset titles (localized) in tables Org titles (localized) instead of org ckan name in tables
This is a bit tricky, because those values are baked into report data. I can translate this on the fly in html report, but values in csv/json exports will be untranslated. Alternatively, I'll have to put all translations into report, and for ui select ones for current language
Link to report section in home footer, visible only to admin
I've added this in footer_links
block on left, so it will be visible whether provbz plugins is used or not:
@cezio
Dataset titles (localized) in tables Org titles (localized) instead of org ckan name in tables
We have to choose the most performing way, the HTML report page could contain several dataset/organization records. If translating on the fly dataset/org name in HTML page is acceptable in terms of rendering performance ok (this is related also to the involved DB queries), otherwise we need to do that in report generation.
Strings not localized (not working):
In provbz we have a ckan's 2.4.3 version that does not support ITranslations so, as I told you, we are using external i18n translations files for DE and IT for Ckan that include translations for reports too.
Link to report section in home footer, visible only to admin
Starting from the URL below http://test-dati.retecivica.bz.it/it/report/resources-format?res_format=WMS and changing language an erroro occurs (400 bad request, Option not allowed by report: res_format=WMS) Starting from the URL below http://test-dati.retecivica.bz.it/it/report/broken-links?org=provincia-autonoma-di-bolzano-alto-adige-astat and changing language an erroro occurs (400 bad request, Option not allowed by report: org=provincia-autonoma-di-bolzano-alto-adige-astat)
This happens only if ckanext-provbz
is used, then url is urlencoded:
<form class="form-inline form-select lang-select" action="/util/redirect" data-module="select-switch" method="POST">
<label for="field-lang-select">Lingua</label>
<br/>
<select id="field-lang-select" name="url" data-module="autocomplete" data-module-dropdown-class="lang-dropdown" data-module-container-class="lang-container">
*** <option value="/it/report/resources-format?res_format%3DWCS" selected="selected">***
italiano
</option>
*** <option value="/de/report/resources-format?res_format%3DWCS" >***
Deutsch
</option>
</select>
<button class="btn js-hide" type="submit">Vai</button>
</form>
In vanilla ckan this doesn't happen.
This is because in provbz template is using request env var directly in language selection snippet: https://github.com/geosolutions-it/ckanext-provbz/blob/master/ckanext/provbz/templates/snippets/language_selector.html#L11
While vanilla ckan uses helper: https://github.com/ckan/ckan/blob/ckan-2.5.7/ckan/templates/snippets/language_selector.html#L6
This is fixed in https://github.com/geosolutions-it/ckanext-provbz/pull/39
In provbz we have a ckan's 2.4.3 version that does not support ITranslations so, as I told you, we are using external i18n translations files for DE and IT for Ckan that include translations for reports too.
Thx. translations updated: https://github.com/geosolutions-it/ckanext-provbz/pull/41
Org titles (localized) instead of org ckan name in tables Dataset titles (localized) in tables
I've added helper to get localized titles of orgs/datasets. For performance i've added short-living in-memory cache so number of db queries is limited. Note that for larger reports (1-2k+ rows) we probably could use some pagination. They're generated and rendered in over 5 seconds anyway due to amount of data now.
Strings not localized (not working):
Other useful: