🎩 User Story
The app's seeds are currently explicitly defining translations for (only) three locales: en, es, ca. As the seeds will be executed on an external app's context, we can't be sure those are the locales included in I18n.available_locales. There might be more, or less, so we'd be potentially breaking the seeding for that app.
Let's find a way to abstract that via a Faker module inside decidim-dev.
Example:
module Decidim
module Dev
module Faker
class Localized < ::Faker::Base
class << self
def words(*arguments)
I18n.available_locales.inject({}) do |result, locale|
result.merge(locale => Fake::Lorem.words(*arguments))
end
end
def literal(text)
I18n.available_locales.inject({}) do |result, locale|
result.merge(locale => text)
end
end
end
end
end
end
end
Bonus points: Use the same generators on tests and factories.
📋 Related documentation
🎯 Acceptance criteria
We can generate an app with a different set of initial languages and seeds are generated for every language.
📌 Related issues
Will definitely ease the way to: https://github.com/codegram/decidim/pull/159
🎩 User Story
The app's seeds are currently explicitly defining translations for (only) three locales:
en,es,ca. As the seeds will be executed on an external app's context, we can't be sure those are the locales included inI18n.available_locales. There might be more, or less, so we'd be potentially breaking the seeding for that app.Let's find a way to abstract that via a
Fakermodule insidedecidim-dev.Example:
Bonus points: Use the same generators on tests and factories.
📋 Related documentation
Loremgenerator: https://github.com/stympy/faker/blob/master/lib/faker/lorem.rb🎯 Acceptance criteria
We can generate an app with a different set of initial languages and seeds are generated for every language.
📌 Related issues
Will definitely ease the way to: https://github.com/codegram/decidim/pull/159