Posts Tagged ‘javascript’

h1

javascript value and rails I18n

September 8, 2009

Today i stumble about the following problem, i have a javascript value and want it inside a localized rails string.

„This is my string javascriptvalue and so on …“

solution

'<%= T("This is my string ## and so on ...", :translate_string) %>'.sub(/##/, javascript_value);

i simple use javascript sub to replace ## with the javascript_value.

🙂

Advertisements