Giter VIP home page Giter VIP logo

tolk's Introduction

Tolk

Build Status

Tolk is a Rails engine designed to facilitate the translators doing the dirty work of translating your application to other languages.

Requirements

Tolk is compatible with Rails 4 and 5

Installation & Setup

To install add the following to your Gemfile:

  gem 'tolk'

Also add either kaminari or will_paginate:

gem 'kaminari'
# OR
gem 'will_paginate'

To setup just run:

  $ rake tolk:setup

and follow the guide!

Usage

Setup and import

Tolk treats I18n.default_locale as the master source of strings to be translated. If you want the master source to be different from I18n.default_locale, you can override it by setting Tolk::Locale.primary_locale_name. Developers are expected to make all the changes to the master locale file ( en.yml by default ) and treat all the other locale.yml files as readonly files.

As tolk stores all the keys and translated strings in the database, you need to ask Tolk to update its database from the primary yml file:

  $ rake tolk:sync

The above will fetch all the new keys from en.yml and put them in the database. Additionally, it'll also get rid of the deleted keys from the database and reflect updated translations - if any.

If you already have data in your non primary locale files, you will need to import those to Tolk as a one time thing:

  $ rake tolk:import

Upon visiting http://your_app.com/tolk - you will be presented with different options like creating new locale or providing translations for the existing locales.

Saving locales to files

Once done with translating all the pending strings, you are can write back the new locales to filesystem. You have two options when dumping database locale data to file:

  $ rake tolk:dump_yaml["the_target_locale"]

This command will generate a single yml file for a specified locale. The locale ISO code should be given in string format as the only argument ("en-us" or "en-gb" for example).

  $ rake tolk:dump_all

This will generate yml files for all non primary locales and put them in #{Rails.root}/config/locales/ directory by default.

You can use the dump_all method defined in Tolk::Locale directly and pass directory path as the argument if you want the generated files to be at a different location:

  $ rails runner "Tolk::Locale.dump_all('/Users/lifo')"

You can even download the yml file using Tolk web interface by appending .yaml to the locale url. E.g http://your_app.com/tolk/locales/de.yaml

Settings

You can add some settings in the initializer file

# config/initializers/tolk.rb
Tolk.config do |config|
  config.exclude_gems_token = true
  # exclude locales tokens from gems.

  config.block_xxx_en_yml_locale_files = true
  # reject files of type xxx.<locale>.yml when syncing locales.

  config.ignore_locale_files = []
  # specify an array of files to skip ["devise"] will skip devise.<locale>.yml when syncing locales.

  config.dump_path = '/new/path'
  # Dump locale path by default the locales folder (config/locales).

  config.mapping['en'] = 'New English'
  config.mapping['fr'] = 'New French'
  # Mapping : a hash of the type { 'ar' => 'Arabic' }.

  config.primary_locale_name = 'de'
  # primary locale to not be overriden by default locale in development mode.

  config.strip_texts = false
  # Don't strip translation texts automatically

  config.ignore_keys = ['faker', 'devise']
  # Ignore all faker.* and devise.* keys
end

Translation statistics

You can ask statistics about missing or updated translations to be tracked for third party tools in http://your_app.com/tolk/stats.json endpoint.

{
  "ar":
    {
      "missing":2928,
      "updated":17,
      "updated_at":"2013-03-04T12:44:03Z"
    }
  ,"ca":
    {
      "missing":1377,
      "updated":1,
      "updated_at":"2013-03-04T13:06:46Z"
    }
  ,"fr":
    {
      "missing":735,
      "updated":5,
      "updated_at":"2013-03-04T13:15:51Z"
    }
}

Authentication

If you want to authenticate users who can access Tolk, you need to provide Tolk::ApplicationController.authenticator proc. For example:

  # config/initializers/tolk.rb
  Tolk::ApplicationController.authenticator = proc {
    authenticate_or_request_with_http_basic do |user_name, password|
      user_name == 'translator' && password == 'transpass'
    end
  }

Authenticator proc will be run from a before filter in controller context.

Handling blank and non-string values

Tolk speaks YAML for non strings values. If you want to enter a nil values, you could just enter '~'. Similarly, for an Array value, you could enter:

  ---
  - Sun
  - Mon

And Tolk will take care of generating the appropriate entry in the YAML file.

Launch test locally

bin/rails test

tolk's People

Contributors

bogdanvlviv avatar ck3g avatar dhh avatar dnrce avatar drogus avatar eldub avatar fcsonline avatar fernandomm avatar freetwix avatar grk avatar gshilin avatar jmccartie avatar jmvallet avatar laurens avatar lifo avatar lime avatar miloops avatar nomnomcameron avatar printercu avatar raouldevil avatar ressu avatar rikas avatar schnika avatar simpl1g avatar suung avatar thomasdarde avatar ugomare avatar wesbillman avatar wvanbergen avatar yaroslav avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tolk's Issues

Feature: Tolk using its own database

I have a Rails 3 app that uses Mongo db but I still wanted to use Tolk for handling translations. I've changed things in a fork that makes Tolk use its own sqlite database instead of the application's db.

You can see the actual commit here: reallyenglish@22ae759

I've tried it successfully on my application and I wondered if this is something you'd be interested in bringing to the main gem. There are a couple of things I'd like to tidy up but if you like this idea in principal, I'll finish up and submit a pull request.

Download the locale doesn't work

NoMethodError at /translate/locales/en.yaml

Message undefined method `ya2yaml' for #<Hash:0x007f73bab9c438>
File    ./tolk-1.3.7/app/controllers/tolk/locales_controller.rb
Line    16

translations from two keys visible as one, placed in one field

When adding a new locale, we get a lot of phrases to translate. One of them is the one with the key activerecord.errors.messages.restrict_dependent_destroy. It looks like this in the english version (visible on tolk):

---
one: Cannot delete record because a dependent %{record} exists
many: Cannot delete record because dependent %{record} exist

In my app I ask people not related to programming to translate the app. So if they see this phrase, they start to translate the "one" and "many", forget about the "---" etc. And when clicking on Save, they get an ugly error (Psych::SyntaxError: (): mapping values are not allowed in this context). Would it be possible, to split this phrase into 2 separate phrases, with two separate keys? So that for the key activerecord.errors.messages.restrict_dependent_destroy.one they would have to translate Cannot delete record because a dependent %{record} exists and the second by analogy.

I know those phrases are already translated on the internet and I could add them to the app. I will do, but sometimes they add a new locale, let's say, for fun, without telling me, so I don't add the translations and I don't run the import for all the locales in the world if I'm not asked to. Still, I would like to avoid seeing the error.

Thanks!

Booleans are handled incorrectly with Rails 4.2.0.beta

See the rails4.2 branch. The following test failures occur:

  1) Failure:
TranslationTest#test_translation_with_true_value [/home/travis/build/tolk/tolk/test/unit/translation_test.rb:46]:
Expected: true
  Actual: 1


  2) Failure:
TranslationTest#test_translation_with_false_value [/home/travis/build/tolk/tolk/test/unit/translation_test.rb:50]:
Expected: false
  Actual: 0


  3) Failure:
TranslationTest#test_translation_is_not_changed_when_text_is_assigned_an_equal_value_in_numberic_form [/home/travis/build/tolk/tolk/test/unit/translation_test.rb:22]:
Expected: false
  Actual: true


  4) Failure:
LocaleTest#test_dumping_all_locales_to_yml [/home/travis/build/tolk/tolk/test/unit/locale_test.rb:83]:
--- expected
+++ actual
@@ -7,5 +7,5 @@
   number:
     currency:
       format:
-        significant: true
+        significant: 1
 "



  5) Failure:
LocaleTest#test_turning_locale_with_nested_phrases_into_a_hash [/home/travis/build/tolk/tolk/test/unit/locale_test.rb:29]:
--- expected
+++ actual
@@ -1 +1 @@
-{"en"=>{"hello_world"=>"Hello World", "nested"=>{"hello_world"=>"Nested Hello World", "hello_country"=>"Nested Hello Country"}, "number"=>{"human"=>{"format"=>{"precision"=>1}}, "currency"=>{"format"=>{"significant"=>false}}}}}
+{"en"=>{"hello_world"=>"Hello World", "nested"=>{"hello_country"=>"Nested Hello Country", "hello_world"=>"Nested Hello World"}, "number"=>{"currency"=>{"format"=>{"significant"=>0}}, "human"=>{"format"=>{"precision"=>1}}}}}

Tolk code can't be searched on GitHub

Because tolk/tolk is still registered as a fork of miloops/tolk (which is in turn a fork of dhh/tolk), GitHub doesn't provide code search results.

Someone within the Tolk team could contact GitHub to transfer the fork root to tolk/tolk.

Redundant active_record translations when default_locale is non-english

My primary locale is :ru, and therefore when translating into English, I'm presented with all of these redundant fields:

activerecord.attributes.address.apartment: ะšะฒะฐั€ั‚ะธั€ะฐ 
activerecord.attributes.address.building: ะšะพั€ะฟัƒั

Of course things like Model.human_name and Model#human_attribute_name are already taking their english values from code, and all the empty fields are cluttering tolk interface. I'd like to propose a checkbox to filter them out.

Importing fails with a undefined method `each' for nil:NilClass

The import seems to fail

[code]
? Do you wan't to install the optional configuration file (to change mappings, locales dump location etc..) ? Press for [Y] >
create config/initializers/tolk.rb
- Adding a migration...
create db/migrate/20130125082651_create_tolk_tables.rb
? Where do you want to mount tolk? Press for [tolk] > translate
gsub config/routes.rb
gsub config/routes.rb
route mount Tolk::Engine => '/translate', :as => 'tolk'
- Job's done: migrate, start your server and visit '/translate'!
== CreateTolkTables: migrating ===============================================
-- create_table(:tolk_locales)
-> 0.0462s
-- add_index(:tolk_locales, :name, {:unique=>true})
-> 0.0206s
-- create_table(:tolk_phrases)
-> 0.0143s
-- create_table(:tolk_translations)
-> 0.0294s
-- add_index(:tolk_translations, [:phrase_id, :locale_id], {:unique=>true})
-> 0.0251s
== CreateTolkTables: migrated (0.1362s) ======================================

rake aborted!
undefined method each' for nil:NilClass /Users/jordan/.rvm/gems/ruby-1.9.3-p194/gems/tolk-1.3.4/lib/tolk/sync.rb:24:inflat_hash'
/Users/jordan/.rvm/gems/ruby-1.9.3-p194/gems/tolk-1.3.4/lib/tolk/sync.rb:20:in read_primary_locale_file' /Users/jordan/.rvm/gems/ruby-1.9.3-p194/gems/tolk-1.3.4/lib/tolk/sync.rb:15:inload_translations'
/Users/jordan/.rvm/gems/ruby-1.9.3-p194/gems/tolk-1.3.4/lib/tolk/sync.rb:9:in sync!' /Users/jordan/.rvm/gems/ruby-1.9.3-p194/gems/tolk-1.3.4/lib/tasks/tolk_tasks.rake:19:inblock (2 levels) in <top (required)>'
/Users/jordan/.rvm/gems/ruby-1.9.3-p194/gems/tolk-1.3.4/lib/tasks/tolk_tasks.rake:13:in `block (2 levels) in <top (required)>'
Tasks: TOP => tolk:sync
(See full trace by running task with --trace)

[/code]

Translation not saved, error message not displaying

Using Tolk under a Rails 2.3.5 app, there is an error message from translation.rb "The translation should contain the variables..." that isn't being displayed. Instead clicking "Save changes" just refreshes the form with empty fields and nothing saved.

This warning is in the logs:

    /vendor/plugins/tolk/app/models/tolk/translation.rb:115: warning: default `to_a' will be obsolete

Feature: Have a way for localizers to flag translations

A couple of translators working on Favstar are adding some strings (such as ???) when they've translated something but want to review it later. It would be cool if this could be a native flag feature - leaving the translation as pristine as they can make it..

You'd want a list of translation you or others have flagged..

javascript error: Uncaught controls.js requires including script.aculo.us' effects.js library controls.js

fix: open tolk source code , app/assets/javascript/tolk/application.js, move //= require tolk/effects.js to below //= require tolk/prototype.js .

but there is another error : Uncaught TypeError: Object # has no method 'measure'

and when i add an chinese translation and click apply changes, another error triggered:

Encoding::UndefinedConversionError in Tolk::LocalesController#dump_all
"\xE5" from ASCII-8BIT to UTF-8

Change in variables on existing phrase prevents sync

When the base phrase is updated and variables are changed or removed, Tolk::Sync#sync_phrases fails in the check_matching_variables validation when updating the Tolk::Translation#primary_updated flag of the secondary translations.

Clean Rails 3.2.7 Install - New locale has 106 translations required

I created a brand new rails project, and added tolk and nothing else.

Creating a new locale says there are 106 translations required. It would be great if these could be reduced or eliminated to save translators time.

I first noticed that tolk was adding will_paginate translations required, when tolk is the only reason will_paginate is included. It would be nice for these not to be included if will_paginate isn't used anywhere else.

The other items that are created are likely from standard rails items. Perhaps they could be automatically seeded from a localization project such as http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale

dump makes problem

on Apply Changes or use any rake _tolk:dump_* ,the specific files update but you will see :

_Routing Error
uninitialized constant Tolk::Pagination
_

and should restart the server(rails s).

'rake tolk:sync' seems slow

The 'rake tolk:sync' command, which I do frequently, seems slow, even after loading Rails.

Could it be that tolk (so far) has used a quick-and-dirty algorithm for this syncing? Now that tolk is working well, could there be easy, low-hanging fruit to speed up the syncing?

For subtrees of YAML language keys, I guess it could:

  • Select bigger batches of rows (rowsets?) from the database;
  • Update rows in bigger batches, letting the database software return an error if someone else has changed a row, which usually wouldn't happen on development boxes.

Perhaps:

  1. From the database, request (just) the ID's for all the main language-file YAML keys, in one big response, to find those (that are) gone from YAML;

  2. Request from the database (just) the main language strings for all the ID's (that should still exist) in one big response, to see what's changed;

  3. Then, for each language's database table:

    a. Delete the unwanted rows in one big request;
    b. For the main language keys whose strings have changed:

    1. Update those rows of the main language's database in one big request;

    2. Then, for each other language:

      a. Blank (by updating) those rows in that language's database in one big request.

I'm using tolk 1.3.4 with Rails 3.2.9 on Ruby 1.9.3, and I have, in config/locales, two languages of YAML totaling 52,691 bytes.

I can login with wrong username and password

Hi guys,

I'm using Tolk for the first time, and followed the authentication example.

And then I wrote a wrong username and password and I logged in successfuly.

This is my tolk.rb initializer

# encoding: utf-8

# Tolk config file. Generated on June 29, 2012 15:26
# See github.com/tolk/tolk for more informations


Tolk::ApplicationController.authenticator = proc {
  authenticate_or_request_with_http_basic do |user_name, password|
    user_name == 'translator' && password == 'transpass'
  end
}

Tolk::Locale.primary_locale_name = :pt

Tolk.config do |config|

  # If you need to add a mapping do it like this :
  # May we suggest you use http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
  # config.mapping["fr-ES"] = 'Fraรฑol !'

end

Thanks

CSS compilation error

V8::Error: /var/bundle/ruby/2.1.0/gems/tolk-1.9.1/app/assets/stylesheets/tolk/application.css:1:1: Unknown word

rails 4.2.1
sprockets 3.0.1
autoprefixer-rails 5.1.11

Looks like application.css should looks like

//= require 'tolk/reset.css'
//= require 'tolk/screen.css'

instead of

# =require 'tolk/reset.css'
# =require 'tolk/screen.css'

Error message: invalid value for Float(): "."

Hello!

While running rake tolk:sync command I get this error message: invalid value for Float(): "."

Backtrace:

rake aborted!
invalid value for Float(): "."
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/transform/to_float.rb:22:in Float' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/transform/to_float.rb:22:intransform?'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/transform.rb:19:in block in to_guessed_type' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/transform.rb:18:ineach'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/transform.rb:18:in to_guessed_type' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/transform.rb:34:into_proper_type'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:62:in resolve_scalar' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:22:inresolve_node'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:46:in block in resolve_map' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:45:ineach'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:45:in resolve_map' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:18:inresolve_node'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:46:in block in resolve_map' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:45:ineach'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:45:in resolve_map' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:18:inresolve_node'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:46:in block in resolve_map' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:45:ineach'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:45:in resolve_map' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:18:inresolve_node'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:46:in block in resolve_map' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:45:ineach'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:45:in resolve_map' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:18:inresolve_node'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:46:in block in resolve_map' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:45:ineach'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:45:in resolve_map' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:18:inresolve_node'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:58:in block in resolve_seq' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:58:ineach'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:58:in inject' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:58:inresolve_seq'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/psych_resolver.rb:17:in resolve_root' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml/resolver.rb:16:inresolve_node'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml.rb:84:in safe_load' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml.rb:88:inblock in safe_load_file'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml.rb:88:in open' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml.rb:88:insafe_load_file'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/safe_yaml-0.8.5/lib/safe_yaml.rb:71:in load_file_with_options' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n/backend/base.rb:172:inload_yml'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n/backend/base.rb:157:in load_file' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n/backend/base.rb:15:inblock in load_translations'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n/backend/base.rb:15:in each' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n/backend/base.rb:15:inload_translations'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n/backend/simple.rb:57:in init_translations' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/tolk-1.3.7/lib/tolk/sync.rb:13:inload_translations'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/tolk-1.3.7/lib/tolk/sync.rb:9:in sync!' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/tolk-1.3.7/lib/tasks/tolk_tasks.rake:19:inblock (2 levels) in <top (required)>'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:in call' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:inblock in execute'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:in each' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:inexecute'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:166:in block in invoke_with_call_chain' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:inmon_synchronize'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:159:in invoke_with_call_chain' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:152:ininvoke'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:143:in invoke_task' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:inblock (2 levels) in top_level'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in each' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:inblock in top_level'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:110:in run_with_threads' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:95:intop_level'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:73:in block in run' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:instandard_exception_handling'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:70:in run' /Users/Irbiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rake-10.0.3/bin/rake:33:in<top (required)>'
/Users/Irbiz/.rbenv/versions/1.9.3-p194/bin/rake:23:in load' /Users/Irbiz/.rbenv/versions/1.9.3-p194/bin/rake:23:in

'

Development: Migration error running tests with Rails 4.1

$ bundle exec rake
/home/travis/.rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.6/lib/active_record/migration.rb:389:in `check_pending!':  (ActiveRecord::PendingMigrationError)

Migrations are pending. To resolve this issue, run:

    bin/rake db:migrate RAILS_ENV=test

    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.6/lib/active_record/migration.rb:395:in `load_schema_if_pending!'
    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.6/lib/active_record/migration.rb:401:in `block in maintain_test_schema!'
    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.6/lib/active_record/migration.rb:629:in `suppress_messages'
    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.6/lib/active_record/migration.rb:406:in `method_missing'
    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.6/lib/active_record/migration.rb:401:in `maintain_test_schema!'
    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.6/lib/rails/test_help.rb:19:in `<top (required)>'
    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `block in require'
    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
    from /home/travis/build/tolk/tolk/test/test_helper.rb:6:in `<top (required)>'
    from /home/travis/build/tolk/tolk/test/integration/authentication_test.rb:1:in `require'
    from /home/travis/build/tolk/tolk/test/integration/authentication_test.rb:1:in `<top (required)>'
    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/rake_test_loader.rb:10:in `require'
    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/rake_test_loader.rb:9:in `each'
    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/rake_test_loader.rb:9:in `block in <main>'
    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/rake_test_loader.rb:4:in `select'
    from /home/travis/.rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/rake_test_loader.rb:4:in `<main>'
rake aborted!
Command failed with status (1): [ruby -I"lib:lib:test" -I"/home/travis/.rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib" "/home/travis/.rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/rake_test_loader.rb" "test/**/*_test.rb" ]
/home/travis/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `eval'
/home/travis/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => default => test
(See full trace by running task with --trace)

Save empty string in tolk

Working with a larger number of translations I sometimes see the need to have an empty string as value. Tolk does not accept empty values, for a good reason. But I was wondering if there is any way of doing this anyway with some YML markup or if it would be an idea to add this feature with a special character or something?

delayed_job break on using tolk

After including tolk in my Gemfile, my delayed job workers start throwing error:
Hash failed with NoMethodError: undefined method `perform' for #Hash:0x007fa568901fb8.
I tried using {YAML::ENGINE.yamler = 'psych'} in boot.rb but no luck.
Please help !!

Will_paginate broke my app

Using Tolk, in the app that is using Kaminari, instead of Will_paginate will break that App.
Cost me a Friday night. I forked it now, and ill try to change it so it can use Kaminari.
Be careful about this, if you are not using will_paginate.

Rails 4.1 Compatibility

In Rails 4.1 the ActiveRecord::Associations::Preloader initialization now takes no arguments. That method is called in more than once like here therefore it crashes. It could be fixed changing this:

ActiveRecord::Associations::Preloader.new(result, foo: :bar)

to this:

ActiveRecord::Associations::Preloader.new().preload(result, foo: :bar)

Any thoughts about this??

Tolk with protected_attributes gem

Hi,

I'm using Rails 4 and Ruby 2 and I'm also using protected_attributes gem in my Gemfile. That causes me the following error upon running rake tolk:sync :

NoMethodError: undefined method `to_sym' for nil:NilClass
/Users/ilker/.rvm/gems/ruby-2.0.0-p481/gems/tolk-1.5.1/lib/tolk/sync.rb:14:in `load_translations'
/Users/ilker/.rvm/gems/ruby-2.0.0-p481/gems/tolk-1.5.1/lib/tolk/sync.rb:9:in `sync!'
/Users/ilker/.rvm/gems/ruby-2.0.0-p481/gems/tolk-1.5.1/lib/tasks/tolk_tasks.rake:19:in `block (2 levels) in <top (required)>'
/Users/ilker/.rvm/gems/ruby-2.0.0-p481/gems/bugsnag-2.1.0/lib/bugsnag/rake.rb:34:in `block in bugsnag_define_task'
/Users/ilker/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `eval'
/Users/ilker/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `<main>'

When I further dig down and run the Tolk::Locale.sync! in console I get the following:

Tolk::Locale Load (1.2ms)  SELECT "tolk_locales".* FROM "tolk_locales" WHERE "tolk_locales"."name" = 'en' LIMIT 1
WARNING: Can't mass-assign protected attributes for Tolk::Locale: name

   (0.2ms)  BEGIN
  Tolk::Locale Exists (0.4ms)  SELECT 1 AS one FROM "tolk_locales" WHERE "tolk_locales"."name" IS NULL LIMIT 1
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
   (0.2ms)  ROLLBACK
NoMethodError: undefined method `to_sym' for nil:NilClass
    from /Users/ilker/.rvm/gems/ruby-2.0.0-p481/gems/tolk-1.5.1/lib/tolk/sync.rb:14:in `load_translations'
    from /Users/ilker/.rvm/gems/ruby-2.0.0-p481/gems/tolk-1.5.1/lib/tolk/sync.rb:9:in `sync!'
    from (irb):1
    from /Users/ilker/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.1/lib/rails/commands/console.rb:90:in `start'
    from /Users/ilker/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.1/lib/rails/commands/console.rb:9:in `start'
    from /Users/ilker/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.1/lib/rails/commands.rb:62:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

Any ideas how to work around?

undefined method `find_or_create_by_name' during tolk:setup

I just add tolk 1.6.0alpha1 to my rails 4 / ruby 2.1 project and I get this error on setup.

It does not prevent me to run my app. But I don't know to consequences of this error

rake tolk:setup
           -  Hello, Tolk installer will help you sets things up!
           -  You already have a config file. You're updating, heh? I'm generating a new 'tolk.rb.example' that you can review.
    conflict  config/initializers/tolk.rb.example
Overwrite /Users/christophedufour/workspace/HiDutyFree/config/initializers/tolk.rb.example? (enter "h" for help) [Ynaqdh] Y
       force  config/initializers/tolk.rb.example
           -  Adding a migration...
   identical  db/migrate/20140916090827_create_tolk_tables.rb
           ?  Where do you want to mount tolk? Press <enter> for [tolk] >
        gsub  config/routes.rb
        gsub  config/routes.rb
       route  mount Tolk::Engine => '/tolk', :as => 'tolk'
           -  Job's done: migrate, start your server and visit '/tolk'!
rake aborted!
NoMethodError: undefined method `find_or_create_by_name' for #<Class:0x000001041907a8>
/Users/christophedufour/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
/Users/christophedufour/.rvm/gems/ruby-2.1.1/gems/tolk-1.6.0.alpha1/lib/tolk/import.rb:23:in `import_locale'
/Users/christophedufour/.rvm/gems/ruby-2.1.1/gems/tolk-1.6.0.alpha1/lib/tolk/import.rb:19:in `block in import_secondary_locales'
/Users/christophedufour/.rvm/gems/ruby-2.1.1/gems/tolk-1.6.0.alpha1/lib/tolk/import.rb:19:in `each'
/Users/christophedufour/.rvm/gems/ruby-2.1.1/gems/tolk-1.6.0.alpha1/lib/tolk/import.rb:19:in `import_secondary_locales'
/Users/christophedufour/.rvm/gems/ruby-2.1.1/gems/tolk-1.6.0.alpha1/lib/tasks/tolk_tasks.rake:35:in `block (2 levels) in <top (required)>'
/Users/christophedufour/.rvm/gems/ruby-2.1.1/gems/tolk-1.6.0.alpha1/lib/tasks/tolk_tasks.rake:14:in `block (2 levels) in <top (required)>'
Tasks: TOP => tolk:import
(See full trace by running task with --trace)```

Support for nested locales on a per view base

Currently Tolk does not support for storing locales on a per view/folder base.
Storing locales on a per view base makes maintaining locales much easier.
Is there a way to implement this already by some easy config change or should the rake task be rewritten for this?

By adding to application.rb this line
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '*', '.{rb,yml}')]

Then storing your views like
/config/locales/views/home/en.yml
/config/locales/views/register/en.yml

If this is really not possible out of the box, I will try to create a commit that makes this possible.

config/locales/simple_form.yml does not exists

$ rake tolk:setup
...
rake aborted!
Locale file /Users/drnic/Sites/tolk/config/locales/simple_form.yml does not exists

What does exist is config/locales/simple_form.en.yml instead (from the simple_form project).

Why does tolk want a different file name or an additional yml file?

It's very unclear which Rails versions will work with Tolk

The documentation is unclear. I'm pretty sure Tolk works with Rails 4.0. Does it still work with 3.2?

As a contributor, I'm not sure which versions to be working on, either. Rails 4.1 is presumably a target but isn't working yet. Is anything before 3.2 still supposed to work? Is Ruby 1.8.7 still supported?

If I get a definitive answer here I'll put together a PR to clarify things.

rake tolk:setup - Can't mass-assign protected attributes: key

$ rake tolk:setup

      create  db/migrate/20120515214421_create_tolk_tables.rb
==  CreateTolkTables: migrating ===============================================
-- create_table(:tolk_locales)
NOTICE:  CREATE TABLE will create implicit sequence "tolk_locales_id_seq" for serial column "tolk_locales.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "tolk_locales_pkey" for table "tolk_locales"
   -> 0.0049s
-- add_index(:tolk_locales, :name, {:unique=>true})
   -> 0.0030s
-- create_table(:tolk_phrases)
NOTICE:  CREATE TABLE will create implicit sequence "tolk_phrases_id_seq" for serial column "tolk_phrases.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "tolk_phrases_pkey" for table "tolk_phrases"
   -> 0.0031s
-- create_table(:tolk_translations)
NOTICE:  CREATE TABLE will create implicit sequence "tolk_translations_id_seq" for serial column "tolk_translations.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "tolk_translations_pkey" for table "tolk_translations"
   -> 0.0093s
-- add_index(:tolk_translations, [:phrase_id, :locale_id], {:unique=>true})
   -> 0.0020s
==  CreateTolkTables: migrated (0.0228s) ======================================

rake aborted!
Can't mass-assign protected attributes: key

Gems in my brand new Rails app:

$ bundle list
Gems included by the bundle:
  * actionmailer (3.2.3)
  * actionpack (3.2.3)
  * activemodel (3.2.3)
  * activerecord (3.2.3)
  * activeresource (3.2.3)
  * activesupport (3.2.3)
  * addressable (2.2.8)
  * arel (3.0.2)
  * builder (3.0.0)
  * bundler (1.2.0.pre)
  * coffee-rails (3.2.2)
  * coffee-script (2.2.0)
  * coffee-script-source (1.3.3)
  * commonjs (0.2.6)
  * em-websocket (0.3.6)
  * erubis (2.7.0)
  * eventmachine (0.12.10)
  * execjs (1.3.2)
  * ffi (1.0.11)
  * guard (1.0.3)
  * guard-bundler (0.1.3)
  * guard-livereload (0.4.2)
  * hike (1.2.1)
  * i18n (0.6.0)
  * journey (1.0.3)
  * jquery-rails (2.0.2)
  * json (1.7.3)
  * less (2.2.1)
  * less-rails (2.2.2)
  * libv8 (3.3.10.4)
  * mail (2.4.4)
  * mime-types (1.18)
  * multi_json (1.3.5)
  * pg (0.13.2)
  * polyglot (0.3.3)
  * rack (1.4.1)
  * rack-cache (1.2)
  * rack-livereload (0.3.6)
  * rack-ssl (1.3.2)
  * rack-test (0.6.1)
  * rails (3.2.3)
  * railties (3.2.3)
  * rake (0.9.2.2)
  * rb-fsevent (0.9.1)
  * rdoc (3.12)
  * sass (3.1.18)
  * sass-rails (3.2.5)
  * simple_form (2.0.2)
  * sprockets (2.1.3)
  * therubyracer (0.10.1)
  * thor (0.14.6)
  * tilt (1.3.3)
  * tolk (1.1.0)
  * treetop (1.4.10)
  * twitter-bootstrap-rails (2.0.7)
  * tzinfo (0.3.33)
  * uglifier (1.2.4)
  * will_paginate (3.0.3)
  * ya2yaml (0.31)
  * yajl-ruby (1.1.0)

NoMethodError: undefined method `paginates_per' withoud Kaminari (v1.8.0)

I have will_paginate installed but I still need to install kaminari in order to not receive the "undefined method paginates_per" error.

$ bundle exec rake tolk:sync
rake aborted!
NoMethodError: undefined method `paginates_per' for #<Class:0x007fbf7604b5e0>

Tolk Version: 1.8.0
Ruby: 2.2.1

Also tried with 1.9.0.

tolk:setup messages don't wrap in console

When running the tolk:setup rake task, the console prompts aren't all readable in a standard terminal width:

           -  Hello, Tolk installer will help you sets things up!
nge mappings, locales dump location etc..) ? Press <enter> for [Y] > (to chan
      create  config/initializers/tolk.rb
           -  Adding a migration...
      create  db/migrate/20141008193001_create_tolk_tables.rb
           ?  Where do you want to mount tolk? Press <enter> for [tolk] > 
        gsub  config/routes.rb
        gsub  config/routes.rb
       route  mount Tolk::Engine => '/tolk', :as => 'tolk'
           -  Job's done: migrate, start your server and visit '/tolk'!

N+1 Query

N+1 Query detected
Tolk::Locale => [:translations]
Add to your finder: :includes => [:translations]

Manage primary local

I set my primary local as Polish and English as additional. Can I somehow change values of keys in my primary local via http://my_app.com/tolk ?

tolk/libraries.js isn't precompiled

I fully admit that this might be because of me misunderstanding my application configuration. However, I'm not quite sure how to go about reproducing it in my development environment to track it down.

On production (which is managed by another team in my company) we are getting:

ActionView::Template::Error (tolk/libraries.js isn't precompiled):
    18:     <%= yield %>
    19:   </div>
    20:
    21:   <%= javascript_include_tag "tolk/libraries" %>
    22:   <%= javascript_include_tag "tolk/application" %>
    23: </body>
    24: </html>

I do not get this in my local development environment.

I do notice that tolk/libraries.js isn't included in https://github.com/tolk/tolk/blob/master/app/assets/javascripts/tolk/application.js. I tried adding it on production and had no luck (including running the precompile rake task and restarting the app).

In development I have:

config.assets.compress = false
config.assets.debug = true

In production we have:

  # Disable Rails's static asset server (Apache or nginx will already do this)
  config.serve_static_assets = false
  config.assets.compress = true
  config.assets.compile = false
  config.assets.digest = true

  # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
  config.assets.precompile += %w(
    #...snip
  )

Any tips would be greatly appreciated.

Tolk imports translation tokens from gems, but not translations

Tolk setup imports all translation tokens which have translations. This means that all tokens that come pre-translated by other gems, like rails-i18n get imported to tolk. This leads to problems like mentioned in issue #18. While setup imports the tokens, it doesn't import the translations from those gems.

This can easily be worked around by importing the translations manually. But a real solution would be to import translations only included in the project itself. Since most of those translations will be translated within the gems itself it seems a bit pointless to import them to Tolk.

TinyTds (Sql Server) tolk_phrases.key is not escaped

TinyTds has a problem with the 8 or so references to tolk_phrases.key within models/tolk/locale.rb and probably others because 'key' is a reserved word in Sql Server. I was able to get it working locally by surrounding all of the instances of key with brackets.

seems like rake tolk:sync isn't working on rails 3.2.17

Environment:
rails: 3.2.17
Gemfile:
gem 'tolk'
// gem "protected_attributes" is not included due to error message:

Resolving dependencies...
Bundler could not find compatible versions for gem "activemodel":
  In Gemfile:
    protected_attributes (>= 0) ruby depends on
      activemodel (< 5.0, >= 4.0.0.beta) ruby

    active_attr (>= 0) ruby depends on
      activemodel (3.2.17)

When not using it, bundle works fine, migrations as well. But sync isn't.

rake aborted!
undefined method `each' for nil:NilClass
/Users/giedrius/.rvm/gems/ruby-2.0.0-p247/gems/tolk-1.3.12/lib/tolk/sync.rb:24:in `flat_hash'
/Users/giedrius/.rvm/gems/ruby-2.0.0-p247/gems/tolk-1.3.12/lib/tolk/sync.rb:20:in `read_primary_locale_file'
/Users/giedrius/.rvm/gems/ruby-2.0.0-p247/gems/tolk-1.3.12/lib/tolk/sync.rb:15:in `load_translations'
/Users/giedrius/.rvm/gems/ruby-2.0.0-p247/gems/tolk-1.3.12/lib/tolk/sync.rb:9:in `sync!'
/Users/giedrius/.rvm/gems/ruby-2.0.0-p247/gems/tolk-1.3.12/lib/tasks/tolk_tasks.rake:19:in `block (2 levels) in <top (required)>'
/Users/giedrius/.rvm/gems/ruby-2.0.0-p247/gems/tolk-1.3.12/lib/tasks/tolk_tasks.rake:13:in `block (2 levels) in <top (required)>'
/Users/giedrius/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
/Users/giedrius/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => tolk:sync

Anyone else has same issue?

Gengo

Hi guys,

We're looking at all the different online translation services.

PhraseApp does not support syncing of a specific scope. Only one part of our application needs to be translated. And the UI is not so clear.
LocaleApp looks nice but the command line gem is broken.
WebTranslateIt seems like a good application but is developed only by one men, to much risk.

The strong thing of LocaleApp and PhraseApp is that they support professional translations. PhraseApp has a connection with Gengo.com.

Gengo.com offers a API. So I thought.. maybe cool to make a connection with Gengo inside Tolk. This way you could sync, press button "translate for money", a day later.. tada translations.

Or am I missing something?

Translations will get high attention inside our company so maybe it's something we can help with.

Tolk::Locale.primary_locale_name value gets overridden when running rake tasks.

Hello,

I got the following situation where the Tolk::Locale.primary_locale_name gets overridden by the I18n.default_locale after running rake tasks such as rake tolk:dump_all. Even monkey patching the class attributes wont work for me. After restarting the server (and after the initializers are done) the Tolk::Locale.primary_locale_name is set correctly. But restarting the server is not quite an option for me.

This is the workflow we are using:

  • We added the followin in our init script for tolk:
Tolk::Locale.primary_locale_name = 'master' 
  • Start our server
  • Translate some items
  • run
bundle exec rake tolk:dump_all

Then when we visit our tolk instance for example localhost:3000/tolk route, the Tolk::Locale.primary_locale_name is set to the I18n.default_locale again.

Even when we run a server and console at the same time. And after executing the rake tasks and reloading the console with the command "reload!", the Tolk::Locale.primary_locale_name is set to default.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.