Permalink
Browse files

Move all strings into YAML file

  • Loading branch information...
1 parent 9ab07d4 commit e5108c559651b215769ee9bb008330b1d52953be @sferik committed Jan 16, 2012
View
5 README.md
@@ -1,11 +1,12 @@
# Sign in with Twitter [![Build Status](https://secure.travis-ci.org/sferik/sign-in-with-twitter.png?branch=master)][travis] [![Dependency Status](https://gemnasium.com/sferik/sign-in-with-twitter.png?travis)][gemnasium]
-A Ruby on Rails app that demonstrates how to use the [Sign in with
-Twitter][siwt] workflow using the [twitter gem][twitter] and [OmniAuth][].
+A [Ruby on Rails][ror] application that demonstrates how to use the [Sign in
+with Twitter][siwt] workflow using the [twitter gem][twitter] and [OmniAuth][].
![Sign in with Twitter](https://github.com/sferik/sign-in-with-twitter/raw/master/screenshot.png "Sign in with Twitter")
[travis]: http://travis-ci.org/sferik/sign-in-with-twitter
[gemnasium]: https://gemnasium.com/sferik/sign-in-with-twitter
+[ror]: http://rubyonrails.org/
[siwt]: https://dev.twitter.com/docs/auth/sign-twitter
[twitter]: https://rubygems.org/gems/twitter
[omniauth]: https://rubygems.org/gems/omniauth
View
19 app/views/layouts/application.html.haml
@@ -2,9 +2,10 @@
%html
%head
%title
- Sign in with Twitter
+ = t("app.name")
%meta{:charset => "utf-8"}
- %meta{:name => "Description", :content => "A Ruby on Rails app that demonstrates how to use the Sign in with Twitter workflow using the twitter gem and OmniAuth."}
+ %meta{:name => "Author", :content => t("app.author")}
+ %meta{:name => "Description", :content => t("app.description")}
%link{:rel => "shortcut icon", :href => "/favicon.ico"}
/ HTML5 shim, for IE6-8 support of HTML5 elements
/[if lt IE 9]
@@ -16,27 +17,27 @@
= csrf_meta_tags
%body
%a{:href => "https://github.com/sferik/sign-in-with-twitter"}
- = image_tag("fork-me-on-github.png", :alt => "Fork me on GitHub", :id => "sash")
+ = image_tag("fork-me-on-github.png", :alt => t("nav.sash"), :id => "sash")
.navbar.navbar-static
.navbar-inner
.container
= link_to("Sign in with Twitter", root_path, :class => "brand")
%ul.nav
%li
%a{:href => "https://dev.twitter.com/docs/auth/implementing-sign-twitter"}
- Documentation
+ = t("nav.documentation")
%li
%a{:href => "https://dev.twitter.com/docs/sign-twitter-resources"}
- Resources
+ = t("nav.resources")
%li
%a{:href => "http://travis-ci.org/sferik/sign-in-with-twitter"}
- Build Status
+ = t("nav.build_status")
%li
%a{:href => "https://gemnasium.com/sferik/sign-in-with-twitter"}
- Dependency Status
+ = t("nav.dependency_status")
%li
%a{:href => "https://github.com/sferik/sign-in-with-twitter"}
- Source Code
+ = t("nav.source_code")
.container
- if flash[:notice]
.alert-message.warning
@@ -58,4 +59,4 @@
= yield
%footer
%p
- = "© #{Date.today.year} Erik Michaels-Ober.".html_safe
+ = "© #{Date.today.year} #{t("app.author")}.".html_safe
View
19 app/views/sessions/show.html.haml
@@ -17,17 +17,17 @@
%thead
%tr
%th
- Location
+ = t("th.location")
%th
- Tweets
+ = t("th.tweets")
%th
- Following
+ = t("th.following")
%th
- Followers
+ = t("th.followers")
%th
- Favorites
+ = t("th.favorites")
%th
- Listed
+ = t("th.listed")
%tbody
%tr
%td
@@ -47,14 +47,13 @@
.span2
= form_tag(signout_path, :method => 'delete') do
%button.btn.danger#sign_out
- Sign out
+ = t("button.sign_out")
.span9
- unless @user.status.blank?
%blockquote
%q{:cite => "https://twitter.com/#{@user.screen_name}/status/#{@user.status.id}"}
%p
= auto_link(@user.status.text).html_safe
%small
- = time_ago_in_words(@user.status.created_at).capitalize
- ago via
- = @user.status.source.html_safe
+ = t("time.ago", :time => time_ago_in_words(@user.status.created_at).capitalize)
+ = t("via.source", :source => @user.status.source).html_safe
View
17 app/views/welcome/index.html.haml
@@ -1,21 +1,10 @@
.page-header
%h6
- A
- %a{:href => "http://rubyonrails.org/"}
- Ruby on Rails
- app that demonstrates how to use the
- %a{:href => "https://dev.twitter.com/docs/auth/sign-twitter"}
- Sign in with Twitter
- workflow using the
- %a{:href => "https://rubygems.org/gems/twitter"}
- twitter gem
- and
- %a{:href => "https://rubygems.org/gems/omniauth"}
- OmniAuth
+ = t("app.description_html", :omniauth => t("link.omniauth_html"), :ruby_on_rails => t("link.ruby_on_rails_html"), :sign_in_with_twitter => t("link.sign_in_with_twitter_html"), :twitter_gem => t("link.twitter_gem_html"))
.row
.span14
= form_tag "/auth/twitter", :method => 'get' do
%button.btn.large.primary
- Sign in with Twitter
+ = t("button.sign_in")
%p.help-block
- Start by pressing this button to authenticate with Twitter.
+ = t("help.sign_in")
View
37 config/locales/en.yml
@@ -1,5 +1,34 @@
-# Sample localization file for English. Add more files in this directory for other locales.
-# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
-
en:
- hello: "Hello world"
+ app:
+ author: "Erik Michaels-Ober"
+ description: "A Ruby on Rails application that demonstrates how to use the Sign in with Twitter workflow using the twitter gem and OmniAuth."
+ description_html: "A %{ruby_on_rails} application that demonstrates how to use the %{sign_in_with_twitter} workflow using the %{twitter_gem} and %{omniauth}."
+ name: "Sign in with Twitter"
+ button:
+ sign_in: "Sign in with Twitter"
+ sign_out: "Sign out"
+ help:
+ sign_in: "Start by pressing this button to authenticate with Twitter."
+ link:
+ omniauth_html: "<a href=\"https://rubygems.org/gems/omniauth\">OmniAuth</a>"
+ ruby_on_rails_html: "<a href=\"http://rubyonrails.org/\">Ruby on Rails</a>"
+ sign_in_with_twitter_html: "<a href=\"https://dev.twitter.com/docs/auth/sign-twitter\">Sign in with Twitter</a>"
+ twitter_gem_html: "<a href=\"https://rubygems.org/gems/twitter\">twitter gem</a>"
+ nav:
+ build_status: "Build Status"
+ dependency_status: "Dependency Status"
+ documentation: "Documentation"
+ resources: "Resources"
+ sash: "Fork me on GitHub"
+ source_code: "Source Code"
+ th:
+ location: "Location"
+ tweets: "Tweets"
+ following: "Following"
+ followers: "Followers"
+ favorites: "Favorites"
+ listed: "Listed"
+ time:
+ ago: "%{time} ago"
+ via:
+ source: "via %{source}"
View
4 test/functional/sessions_controller_test.rb
@@ -19,8 +19,10 @@ class SessionsControllerTest < ActionController::TestCase
session[:access_token] = 'abc'
session[:access_secret] = '123'
stub_request(:get, 'https://api.twitter.com/1/account/verify_credentials.json').
+ with(:query => {"include_entities" => "true"}).
to_return(:body => File.read(File.expand_path('../../fixtures/user.json', __FILE__)), :status => 200)
- stub_request(:get, "https://api.twitter.com/1/users/show.json?screen_name=sferik").
+ stub_request(:get, "https://api.twitter.com/1/users/show.json").
+ with(:query => {"screen_name" => "sferik"}).
to_return(:body => File.read(File.expand_path('../../fixtures/user.json', __FILE__)), :status => 200)
get :show
assert_not_nil assigns :user

0 comments on commit e5108c5

Please sign in to comment.