First Draft (22 October 2016)
Updated: 26 October 2016
The task list:
- Look into the current state and what’s still missing (3h)
- Estimate the work on unfinished internationalisation (1h)
- Estimate the work on flexible Javascript translations (1h)
- Estimate UI changes to choose another language (1h)
- Research current ways for multi-language db models (2h)
- Estimate the integration of the top contenders (4h)
- Summarise the results in a nice document, broken down into small tasks (2h)
Work done: 9 of 14 hours
Results:
Outstanding work for multi-language interface
I found 83 files that contain language and need placeholders. (8 hours)
The “open” and “closed” icons still need to be replaced.
We need to discuss and decide which icons to use (3h).
And we need to replace these icons in the current symbol font (3h).
We need to pre-compile a Javascript locale file for each language.
That requires one asset file per language.
We can then compile only those locales defined in the app configuration. (4h)
The Javascript lacks a fall-back feature to show text of the default locale
if the selected locale doesn’t have the translated text.
For example, if the British English translation is not complete, the missing
parts would be displayed in Australian English. (6h)
The previous three tasks could be solved by: https://github.com/fnando/i18n-js
The documentation is good, it’s actively developed and the author works for Heroku. Using this gem is probably much better than developing everything on our own. Just for the worst case that we try to do this for a few hours and find out that it doesn’t work, I would add a worst case estimate (3h)
We need a user interface to switch the language.
That could be a simple button in the navigation bar.
It sets the new locale for the user and then reloads the page in the new language.
The Javascript UI just uses the asset the was loaded depending on the locale setting. (8h)
Optionally, the UI would probably look better if a designer could work on that. (8h)
In the end of this round, we need to test everything, get feedback and react on that. (6h)
Total: 49 hours
Outstanding work for multi-language data
I found only two solutions to store multi-language data in the database:
Globalize seems to be the most popular solution (968,446 downloads) while Hstore Translate (43,269 downloads) is bound to a Postgresql feature. There is also the Spree Globalize gem for newer Spree versions (3.1+). We use Spree 1.3 at the moment. And there is a nice Railscast introcution to Globalize.
Globalize changes our database layout quite a bit. It will add extra work for all future development. Whenever we introduce or change a new data field that should be translatable, we need to change the translation tables as well. Planned Spree upgrades are better done before introducing multi-language features.
Fields to translate
The essentials:
- product name
- product type / category (taxon)
- product properties
- amount unit
- delivery method
- shipping method name
- payment method name
- tax category name
- enterprise fee name
- enterprise description
- shop messages
- group description
For discussion:
- ~ enterprise names
- ~ enterprise images
- ~ enterprise contact details
- ~ addresses (countries, states, suburbs)
- ~ group names
- ~ group images
- ~ group contact details
- ~ order cycle name
- ~ product unit
- ~ product scale
The tasks:
- Discuss data structure change with other developers (10h)
- Add Globalize to the OFN project (2h)
- Change model classes (5h)
- Add initial database migration (5h)
- Possible difficulties / conflict solving (20h)
- Denote translatable fields (5h)
- Add language switcher to the admin interface (6h)
- Final testing and reacting to feedback (11h)
Total: 64 hours
Total of both projects: 113 hours
Doesn’t seem too bad. I expected this project to be bigger.
Not included:
- Multi currency setup
- Locale dependent OpenStreetMaps settings.
Resources
Files containing language:
app/views/admin/enterprise_roles/_enterprise_role.html.haml
app/views/admin/enterprise_roles/_form.html.haml
app/views/admin/enterprise_roles/index.html.haml
app/views/admin/enterprises/_actions.html.haml
app/views/admin/enterprises/_change_type_form.html.haml
app/views/admin/enterprises/_enterprise_user_index.html.haml
app/views/admin/enterprises/_new_form.html.haml
app/views/admin/enterprises/edit.html.haml
app/views/admin/enterprises/form/_about_us.html.haml
app/views/admin/enterprises/form/_address.html.haml
app/views/admin/enterprises/form/_contact.html.haml
app/views/admin/enterprises/form/_enterprise_fees.html.haml
app/views/admin/enterprises/form/_images.html.haml
app/views/admin/enterprises/form/_inventory_settings.html.haml
app/views/admin/enterprises/form/_payment_methods.html.haml
app/views/admin/enterprises/form/_primary_details.html.haml
app/views/admin/enterprises/form/_shipping_methods.html.haml
app/views/admin/enterprises/form/_social.html.haml
app/views/admin/enterprises/form/_tag_rules.html.haml
app/views/admin/enterprises/form/_users.html.haml
app/views/admin/enterprises/form/tag_rules/_default_rules.html.haml
app/views/admin/enterprises/index.html.haml
app/views/admin/enterprises/new.html.haml
app/views/admin/enterprises/welcome.html.haml
app/views/admin/order_cycles/_exchange_form.html.haml
app/views/admin/order_cycles/_exchange_supplied_products_form.html.haml
app/views/admin/order_cycles/_form.html.haml
app/views/admin/order_cycles/_name_and_timing_form.html.haml
app/views/admin/order_cycles/_row.html.haml
app/views/admin/order_cycles/_simple_form.html.haml
app/views/admin/producer_properties/_form.html.haml
app/views/admin/variant_overrides/_controls.html.haml
app/views/admin/variant_overrides/_filters.html.haml
app/views/admin/variant_overrides/_loading_flash.html.haml
app/views/admin/variant_overrides/_show_more.html.haml
app/views/checkout/_shipping_ship_address.html.haml
app/views/spree/admin/products/_distributors_form.html.haml
app/views/spree/admin/products/bulk_edit/_indicators.html.haml
app/views/spree/admin/products/bulk_edit/_products.html.haml
app/views/spree/admin/products/bulk_edit/_products_product.html.haml
app/views/spree/admin/products/bulk_edit/_products_variant.html.haml
app/views/spree/admin/products/bulk_edit/_save_button_row.html.haml
app/views/spree/admin/products/product_distributions.html.haml
app/views/spree/admin/variants/_autocomplete.js.erb
app/views/spree/order_mailer/invoice_email.html.haml
app/views/spree/products/_source.html.haml
app/views/admin/business_model_configuration/edit.html.haml
app/views/admin/cache_settings/show.html.haml
app/views/admin/contents/edit.html.haml
app/views/admin/enterprises/_admin_index.html.haml
app/views/admin/enterprises/form/_business_details.html.haml
app/views/admin/enterprises/form/_shop_preferences.html.haml
app/views/admin/order_cycles/_advanced_settings.html.haml
app/views/admin/producer_properties/index.html.haml
app/views/map/index.html.haml
app/views/producer_mailer/order_cycle_report.text.haml
app/views/spree/admin/orders/_invoice_table.html.haml
app/views/spree/admin/orders/bulk_management.html.haml
app/views/spree/admin/orders/edit.html.haml
app/views/spree/admin/orders/invoice.html.haml
app/views/spree/admin/overview/_enterprises_header.html.haml
app/views/spree/admin/overview/_enterprises_hubs_tab.html.haml
app/views/spree/admin/overview/_order_cycles.html.haml
app/views/spree/admin/products/bulk_edit/_filters.html.haml
app/views/spree/admin/reports/bulk_coop.html.haml
app/views/spree/admin/reports/sales_tax.html.haml
app/views/spree/admin/reports/xero_invoices.html.haml
app/assets/javascripts/templates/admin/info_dialog.html.haml
app/assets/javascripts/templates/admin/links_dropdown.html.haml
app/assets/javascripts/templates/admin/modals/tag_rule_help.html.haml
app/assets/javascripts/templates/admin/new_tag_rule_dialog.html.haml
app/assets/javascripts/templates/admin/panels/enterprise_package.html.haml
app/assets/javascripts/templates/admin/panels/enterprise_producer.html.haml
app/assets/javascripts/templates/admin/panels/enterprise_status.html.haml
app/assets/javascripts/templates/admin/panels/exchange_supplied_products.html.haml
app/assets/javascripts/templates/admin/panels/exchange_tags.html.haml
app/assets/javascripts/templates/admin/tag_rules/filter_order_cycles_input.html.haml
app/assets/javascripts/templates/admin/tag_rules/filter_payment_methods_input.html.haml
app/assets/javascripts/templates/admin/tag_rules/filter_products_input.html.haml
app/assets/javascripts/templates/admin/tag_rules/filter_shipping_methods_input.html.haml
app/assets/javascripts/templates/out_of_stock.html.haml
app/assets/javascripts/templates/single_line_selectors.html.haml