I am developing a Sinatra based web-app using the Sinatra r18n internationalisation system.
My ./i18n/en.yml r18n translation file contains the following:
season:
summer: !!pl
0: no Summers
1: one Summer
n: "%1 Summers"
autumn: !!pl
0: no Autumns
1: one Autumn
n: "%1 Autumns"
winter: !!pl
0: no Winters
1: one Winter
n: "%1 Winters"
spring: !!pl
0: no Springs
1: one Spring
n: "%1 Springs"
In my code I can easily access "Total: #{t.season.summer season_count}." but I’m having trouble trying to access my season names programatically.
s = t.season[season_name] returns a Translation object.
I’ve looked at the source for a Translation however and can’t see the obvious way I’d generate my translated text from that Translation and a number.
You get Translation, because you don’t send count to season[season_name], so R18n return subhash. Just use: