This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
en: | |
pages: | |
home: | |
heading: 'Hello, world!' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1 translate>pages.home.heading</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = angular.module('app', [ | |
'ngRoute', | |
'pascalprecht.translate' | |
]); | |
app.config(['$translateProvider', function($translateProvider) { | |
$translateProvider.useStaticFilesLoader({ | |
prefix: 'locales/', | |
suffix: '.json' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.routes.draw do | |
resources :translations, only: :show | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = angular.module('app', [ | |
'pascalprecht.translate' | |
]); | |
app.config(['$translateProvider', function($translateProvider) { | |
$translateProvider.useStaticFilesLoader({ | |
prefix: 'translations/', | |
suffix: '.json' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TranslationsController < ApplicationController | |
respond_to :json | |
def show | |
@locale = params[:id].to_sym | |
@translations = I18n.with_locale(@locale) do | |
I18n.backend.send(:translations)[@locale] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('controllers', []).controller('SessionsController', ['$scope', '$translate', | |
($scope, $translate)-> | |
$scope.labels = [] | |
$translate(['models.user.labels.email', 'models.user.labels.password']).then( | |
(translations)-> | |
$scope.foo = 'bar' | |
$scope.labels = translations['models.user.labels.email'] | |
console.log 'promise resolved' | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 8.4.3 (api:1/proto:86-101) | |
srcversion: F97798065516C94BE0F27DC | |
0: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r----- | |
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ENV['DISABLE_ASYNC'] | |
require 'sidekiq/testing' | |
Sidekiq::Testing.inline! | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe Processable do | |
# ... | |
describe '#mark_as_processed!' do | |
it 'updates the processed column to true' do | |
subject | |
.expects(:update_column) | |
.with(:processed, true) |