Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8813359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:49:45+00:00 2026-06-14T03:49:45+00:00

When using sinatra-r18n to handle internationalisation, the r18n lib exposes a variable t for

  • 0

When using sinatra-r18n to handle internationalisation, the r18n lib exposes a variable t for use within your helpers, routes and templates, as per these instructions.

I have written a simple unit test using rack-unit to confirm that some of my pluralisations work but the test throws an error claiming t is nil.

I’ve tried referencing it via app.t, MySillyApp.t (where MySillyApp is the name of my Sinatra app), MySillyApp.settings.t etc and none of them give me access to the t I need.

What I am trying to achieve is a confirmation that my translation files include all the keys I need corresponding to plurals of various metric units my app needs to understand. Perhaps there is a more direct way of testing this without going via the Sinatra app itself. I’d welcome any insight here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:49:47+00:00Added an answer on June 14, 2026 at 3:49 am

    I had similar task to check localized strings in my Cucumber scenarios.
    I’ve made working example.
    Here you can find how strings got translated.
    This file halps to understand how to add R18n support to your testing framework:

    require 'r18n-core'
    ...
    
    class SinCucR18nWorld
      ...
      include R18n::Helpers
    end
    

    As you can see instead of rack/unit I’m using RSpec/Cucumber, sorry.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a Sinatra based web-app using the Sinatra r18n internationalisation system. My
I am working on a project using sinatra with haml for templates. I want
I'm using Sinatra's set method in order to assign a global variable: set :location,
How to create a page using Sinatra which will use my prepared index.html.haml template.
I am using Sinatra and have organized my application into models, views and routes
Using Sinatra in Ruby you can set the server's settings by doing: set :myvariable,
I am using Sinatra for my webapp. I have some cleanup code that I
I am using Sinatra and I am in the middle of designing some models.
I'm very new to Ruby and using Sinatra, mainly so that I can do
I'm trying to build an app using Sinatra, Ruby, rack, haml, pony and SendGrid,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.