Multiple Strings for one string to translate?

Hey,

is it somehow possible to translate one string e.g. t(‘hello’) to a
random item of a number of strings?

Example for language files (I know, wrong syntax):
en:
hello: Hello, G’day, Hey, Hi

So every time t(‘hello’) is rendered on of the strings is randomly given
out? Like:

puts t(‘hello’)
-> Hello

puts t(‘hello’)
-> Hey

puts t(‘hello’)
-> G’day

This should fit what you want.

greetings = [“Hello”, “G’day”, “Hey”, “Hi”]

puts greetings[rand(greetings.length)]

Thanks,
B.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs