You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've just realised the project I'm working on uses i18n-tasks and for the most part things are working fine. I have recently added a few things into an en.rb file. It's not that exciting.
But it does mean that we can do things like t(".title", namespace: :demo) without much fuss. However, i18n-tasks doesn't support this out of the box for obvious reasons there are missing translations. We could add an additional adapter for this. But while you can read in the translations. when normalising locales it inserts the keys into the en.yml and with a marhalled Proc object which isn't quite what we're after.
# frozen_string_literal: true
module I18n::Tasks
module Data
module Adapter
module RubyAdapter
class << self
# @return [Hash] locale tree
def parse(str, _)
eval(str)
end
end
end
end
class FileSystem < FileSystemBase
register_adapter :ruby, '*.rb', Adapter::RubyAdapter
end
end
end
Is there a way to get this to work, I'd be happy to do a PR given a little guidance.
The text was updated successfully, but these errors were encountered:
conservative_router tries to keep the keys in the files where they were found. pattern_router routes the keys to files based on the a list of patterns.
You may want to write a custom Router that deals with the keys found in .rb files in some special way, and falls back to your preferred router for other keys.
Hi, I've just realised the project I'm working on uses i18n-tasks and for the most part things are working fine. I have recently added a few things into an
en.rb
file. It's not that exciting.But it does mean that we can do things like
t(".title", namespace: :demo)
without much fuss. However, i18n-tasks doesn't support this out of the box for obvious reasons there are missing translations. We could add an additional adapter for this. But while you can read in the translations. when normalising locales it inserts the keys into the en.yml and with a marhalled Proc object which isn't quite what we're after.Is there a way to get this to work, I'd be happy to do a PR given a little guidance.
The text was updated successfully, but these errors were encountered: