Skip to content

Instantly share code, notes, and snippets.

@mkllnk
Created April 14, 2023 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkllnk/76d576f06a6ae703feb5000bfd9f48ee to your computer and use it in GitHub Desktop.
Save mkllnk/76d576f06a6ae703feb5000bfd9f48ee to your computer and use it in GitHub Desktop.
I18n scope naming convention outside of views
# An idea for a convention. Not sure it will be useful yet.
module I18nLib
def lazy_translate(translation_key, options = {})
scope = self.class.to_s.underscore.tr("/", ".")
options.merge!(scope: scope)
I18n.t(translation_key, **options)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment