0

For example: In "EN.yml":

en:
  aliases:
    - &test test_passed
  some: ["bla-bla", *test, "bla-bla-bla,", *test]

In view.html.erb:

<% @array = t('some') %>
<%= @array.join(" ") %>

RESULT in Browser:

bla-bla test_passed bla-bla-bla, test_passed

My Question: Maybe there is simple way to do this without crutches?

koch
  • 53
  • 2
  • 4

1 Answers1

1

You can pass in variables to the translation.

In en.YML

en:
  aliases:
    - &test test_passed
  some: "bla-bla %{test} bla-bla-bla %{test2}"

In view

<%= t('some', :test => test_value, :test2 => test2_value) %>