v0.2.0
Important
This release present breaking changes. Read carefully if you are upgrading from 0.1.*
Release Notes
This release introduces a new data model for the translation system. Previously, texts in the code were picked up as translation keys. Translations in another locales were stored in the translation model. There was a one-to-many relatioship between TranslationKeys and Translations.
Now, Keys and translations are stored in a common TextEntry
model. There's a many-to-many relationship between text entries through the Translation model. The design has been inspired by the incredible work that is ActiveStorage in Rails.
This change was needed for future features such as #10 and #6.
I am not expecting anyone running Rosetta yet in production, but should you need to upgrade to 0.2.0:
- Export and save your translation keys and their corresponding translations
- Delete TranslationKeys and Translations
- Upgrade the gem version
- run
rails rosetta:install:migrations
andrails db:migrate
- Recreate the translations. (here's a snippet below)
# recreate translations
# assuming a csv with the following columns: translation_key_value, locale_id, translation_value
CSV.foreach(filepath, headers: :first_row) do |row|
base_entry = TextEntry.create(content: row["translation_key_value"], locale: Rosetta::Locale.default_locale)
locale = Rosetta::Locale.find(locale_id)
base_entry.public_send(:"content_#{locale.code}=", translation_value)
base_entry.save
end
What's Changed
- Test against multiple version of core dependencies in the CI system by @virolea in #4
- fix typo by @adrienpoly in #7
- Fix inconsistencies in tests by @virolea in #11
- Replace autodiscovery queue with autodiscovery job by @virolea in #12
- Persist default locale by @virolea in #13
- Scope translations to locale by @virolea in #15
- new domain model for translations by @virolea in #16
New Contributors
- @virolea made their first contribution in #4
- @adrienpoly made their first contribution in #7
Full Changelog: https://github.com/virolea/rosetta/commits/v0.2.0