enriclluelles/route_translator

Issue in translating parameters

aastik1208 opened this issue · 1 comments

I am trying to translate parameters which I am fetching from the database.
Example: first/:data1/abc
I am getting the value of data1 as xyz, I put the translation of xyz in locale files. But it is showing the original value. How can I translate it? (Some middleware I am trying)

Hi.

If I've got the question correctly, what you are trying to achieve is the following behavoiour.

Let's say we have a product

ID Title (English) Title (Italian)
1 hello ciao
2 good-morning buongiorno

You want something like

With :en locale: some_custom_path(Product.find(1)) => /first/hello/abc
With :it locale: some_custom_path(Product.find(1)) => /primo/ciao/abc

Well, this is not supported by route_translator, you probably need another gem for that.

This use case makes me think to friendly_id and globalize. Please take a look at this wiki: https://github.com/enriclluelles/route_translator/wiki/Generating-translated-URLs