Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Using Mobility to Store Translations

Avatar for Ali Ali
April 11, 2021

Using Mobility to Store Translations

These are slides of "Using Mobility to Store Translations", a talk I gave at a Ruby Ireland meet-up.

Repo used for Mobility and setting of locale demos: https://github.com/thealiilman/fresh-translation

My Website: https://ali-ilman.com/
My LinkedIn: https://www.linkedin.com/in/aliilman/
My Twitter: https://twitter.com/thealiilman

Avatar for Ali

Ali

April 11, 2021

More Decks by Ali

Other Decks in Programming

Transcript

  1. • I’m a software engineer from Malaysia • Website ali-ilman.com

    • LinkedIn https:/ /www.linkedin.com/in/aliilman/ • Twitter @thealiilman About Me
  2. THE STATE OF TRANSLATION GEMS IN THE RUBY ECOSYSTEM Globalize

    • Mature • Supports only one type of storage, a translation table for the model • Inactively maintained. Maintainers suggest migrating to Mobility
  3. THE STATE OF TRANSLATION GEMS IN THE RUBY ECOSYSTEM Traco

    • Mature • Supports only one type of storage, columns in the same table • Maintained
  4. ENTER MOBILITY Notable features and concepts in Mobility • Store

    translations with various strategies • Add plugins where necessary or globally • Encapsulates logic for each strategy through “Backends”
  5. When requests to /german and / or /irish endpoints are

    made, /english endpoint will use either German or Irish locale. This isn’t the correct behaviour.
  6. Now, every time we make a request to /english, the

    locale will be set to English. Next slide shows another way to prevent locale leakage by using I18n.with_locale, which ensures that after executing the block, the locale will be set to whatever the value was before.