rails-i18nterface 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/Rakefile +1 -1
- data/app/assets/javascripts/rails_i18nterface/base.js +5 -14
- data/app/assets/stylesheets/rails_i18nterface/application.css +3 -1
- data/app/controllers/rails_i18nterface/translate_controller.rb +6 -3
- data/app/views/rails_i18nterface/translate/index.html.erb +1 -1
- data/config/routes.rb +1 -1
- data/lib/rails-i18nterface.rb +1 -1
- data/lib/rails-i18nterface/log.rb +5 -2
- data/lib/rails-i18nterface/storage.rb +4 -1
- data/lib/rails-i18nterface/version.rb +1 -1
- data/spec/internal/log/test.log +51 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0e0d7a4246ff44ee6cc0865f2b2bcedb3ebf5fd
|
4
|
+
data.tar.gz: 8faea23f3737fc3ece301d0f153c5a85450cd327
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b936cb71327bf12884dbbd9eb6b360ee54a0d3997204b2994f94d446ffedabc1fca32bd7a5dd06af68854ca19435d43d8e1021ba69cb4e11022c6d8d1fad08c
|
7
|
+
data.tar.gz: 7b49046b1b17a6e92efe916f167083274cfeb19c92ff1d500a1806b73463ad08094ee078364812ecb3cb83c93d54448e4673fb6e1ad0e54733fee7593f20ca16
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Rails I18nterface
|
2
2
|
|
3
|
+
[![Dependency Status](https://gemnasium.com/mose/rails-i18nterface.png)](https://gemnasium.com/mose/rails-i18nterface)
|
3
4
|
[![Build Status](https://secure.travis-ci.org/mose/rails-i18nterface.png?branch=master)](http://travis-ci.org/mose/rails-i18nterface)
|
4
5
|
[![Code Climate](https://codeclimate.com/github/mose/rails-i18nterface.png)](https://codeclimate.com/github/mose/rails-i18nterface)
|
5
6
|
[![Gem Version](https://badge.fury.io/rb/rails-i18nterface.png)](http://badge.fury.io/rb/rails-i18nterface)
|
data/Rakefile
CHANGED
@@ -63,20 +63,11 @@ $.domReady(function() {
|
|
63
63
|
e.stopPropagation();
|
64
64
|
key = $(this).previous().text();
|
65
65
|
if (confirm("Are you sure you want to delete the key "+key+" from database ?")) {
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
alert(resp.msg);
|
72
|
-
} else {
|
73
|
-
alert(resp);
|
74
|
-
}
|
75
|
-
},
|
76
|
-
error: function(resp,msg) {
|
77
|
-
alert("Error: " + msg);
|
78
|
-
}
|
79
|
-
})
|
66
|
+
var newF = document.createElement("form");
|
67
|
+
newF.action = 'delete/'+key;
|
68
|
+
newF.method = 'POST';
|
69
|
+
document.getElementsByTagName('body')[0].appendChild(newF);
|
70
|
+
newF.submit();
|
80
71
|
}
|
81
72
|
});
|
82
73
|
});
|
@@ -20,12 +20,15 @@ module RailsI18nterface
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def destroy
|
23
|
-
|
23
|
+
puts params
|
24
|
+
term = RailsI18nterface::Translation.find_by_key(params[:del])
|
24
25
|
if term and term.destroy
|
25
|
-
|
26
|
+
flash[:success] = "Translations removed from database"
|
26
27
|
else
|
27
|
-
|
28
|
+
flash[:notice] = "Translations not found in database"
|
28
29
|
end
|
30
|
+
params[:key] = { params[:del] => '' }
|
31
|
+
update
|
29
32
|
end
|
30
33
|
|
31
34
|
def load_db_translations
|
data/config/routes.rb
CHANGED
@@ -4,5 +4,5 @@ RailsI18nterface::Engine.routes.draw do
|
|
4
4
|
put '/translate' => 'translate#update'
|
5
5
|
get '/reload' => 'translate#reload', as: 'translate_reload'
|
6
6
|
get '/export' => 'translate#export', as: 'translate_export'
|
7
|
-
|
7
|
+
post '/delete/*del' => 'translate#destroy', format: false
|
8
8
|
end
|
data/lib/rails-i18nterface.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'rails-i18nterface/engine'
|
2
|
+
require 'rails-i18nterface/utils'
|
2
3
|
require 'rails-i18nterface/yamlfile'
|
3
4
|
require 'rails-i18nterface/sourcefiles'
|
4
5
|
require 'rails-i18nterface/keys'
|
5
6
|
require 'rails-i18nterface/log'
|
6
7
|
require 'rails-i18nterface/storage'
|
7
|
-
require 'rails-i18nterface/utils'
|
8
8
|
|
9
9
|
module RailsI18nterface
|
10
10
|
end
|
@@ -1,17 +1,20 @@
|
|
1
1
|
module RailsI18nterface
|
2
2
|
class Log
|
3
|
+
|
4
|
+
include Utils
|
5
|
+
|
3
6
|
attr_accessor :from_locale, :to_locale, :keys
|
4
7
|
|
5
8
|
def initialize(from_locale, to_locale, keys)
|
6
9
|
self.from_locale = from_locale
|
7
10
|
self.to_locale = to_locale
|
8
|
-
self.keys = keys
|
11
|
+
self.keys = keys.reject { |k, v| v == '' }
|
9
12
|
end
|
10
13
|
|
11
14
|
def write_to_file
|
12
15
|
current_texts = File.exists?(file_path) ? file.read : {}
|
13
16
|
current_texts.merge!(from_texts)
|
14
|
-
file.write(current_texts)
|
17
|
+
file.write(remove_blanks(current_texts))
|
15
18
|
end
|
16
19
|
|
17
20
|
def read
|
@@ -1,5 +1,8 @@
|
|
1
1
|
module RailsI18nterface
|
2
2
|
class Storage
|
3
|
+
|
4
|
+
include Utils
|
5
|
+
|
3
6
|
attr_accessor :locale
|
4
7
|
|
5
8
|
def initialize(locale)
|
@@ -7,7 +10,7 @@ module RailsI18nterface
|
|
7
10
|
end
|
8
11
|
|
9
12
|
def write_to_file
|
10
|
-
Yamlfile.new(file_path).write(keys)
|
13
|
+
Yamlfile.new(file_path).write(remove_blanks(keys))
|
11
14
|
end
|
12
15
|
|
13
16
|
def self.file_paths(locale)
|
data/spec/internal/log/test.log
CHANGED
@@ -1654,3 +1654,54 @@ Migrating to RenameTranslationToNamespace (20130422115639)
|
|
1654
1654
|
[1m[35m (0.3ms)[0m ALTER TABLE "translations" RENAME TO "rails_i18nterface_translations"
|
1655
1655
|
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20130422115639')[0m
|
1656
1656
|
[1m[35m (157.5ms)[0m commit transaction
|
1657
|
+
Connecting to database specified by database.yml
|
1658
|
+
[1m[36m (0.7ms)[0m [1mselect sqlite_version(*)[0m
|
1659
|
+
[1m[35m (184.9ms)[0m CREATE TABLE "article" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255) NOT NULL, "body" varchar(255), "created_at" datetime, "updated_at" datetime, "active" boolean DEFAULT 't')
|
1660
|
+
[1m[36m (150.9ms)[0m [1mCREATE TABLE "topics" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime) [0m
|
1661
|
+
[1m[35m (158.6ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
1662
|
+
[1m[36m (158.7ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
1663
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
1664
|
+
Migrating to CreateTranslations (20110921112044)
|
1665
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1666
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "translations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "locale" varchar(255), "key" varchar(255), "value" text, "interpolations" text, "is_proc" boolean DEFAULT 'f', "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
1667
|
+
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20110921112044')[0m
|
1668
|
+
[1m[35m (164.3ms)[0m commit transaction
|
1669
|
+
Migrating to RenameTranslationToNamespace (20130422115639)
|
1670
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1671
|
+
[1m[35m (0.3ms)[0m ALTER TABLE "translations" RENAME TO "rails_i18nterface_translations"
|
1672
|
+
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20130422115639')[0m
|
1673
|
+
[1m[35m (149.2ms)[0m commit transaction
|
1674
|
+
Connecting to database specified by database.yml
|
1675
|
+
[1m[36m (0.7ms)[0m [1mselect sqlite_version(*)[0m
|
1676
|
+
[1m[35m (167.2ms)[0m CREATE TABLE "article" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255) NOT NULL, "body" varchar(255), "created_at" datetime, "updated_at" datetime, "active" boolean DEFAULT 't')
|
1677
|
+
[1m[36m (159.4ms)[0m [1mCREATE TABLE "topics" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime) [0m
|
1678
|
+
[1m[35m (158.6ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
1679
|
+
[1m[36m (142.0ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
1680
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
1681
|
+
Migrating to CreateTranslations (20110921112044)
|
1682
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1683
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "translations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "locale" varchar(255), "key" varchar(255), "value" text, "interpolations" text, "is_proc" boolean DEFAULT 'f', "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
1684
|
+
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20110921112044')[0m
|
1685
|
+
[1m[35m (147.0ms)[0m commit transaction
|
1686
|
+
Migrating to RenameTranslationToNamespace (20130422115639)
|
1687
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
1688
|
+
[1m[35m (0.4ms)[0m ALTER TABLE "translations" RENAME TO "rails_i18nterface_translations"
|
1689
|
+
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20130422115639')[0m
|
1690
|
+
[1m[35m (148.7ms)[0m commit transaction
|
1691
|
+
Connecting to database specified by database.yml
|
1692
|
+
[1m[36m (0.7ms)[0m [1mselect sqlite_version(*)[0m
|
1693
|
+
[1m[35m (157.9ms)[0m CREATE TABLE "article" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255) NOT NULL, "body" varchar(255), "created_at" datetime, "updated_at" datetime, "active" boolean DEFAULT 't')
|
1694
|
+
[1m[36m (142.6ms)[0m [1mCREATE TABLE "topics" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime) [0m
|
1695
|
+
[1m[35m (140.5ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
1696
|
+
[1m[36m (142.0ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
1697
|
+
[1m[35m (0.0ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
1698
|
+
Migrating to CreateTranslations (20110921112044)
|
1699
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1700
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "translations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "locale" varchar(255), "key" varchar(255), "value" text, "interpolations" text, "is_proc" boolean DEFAULT 'f', "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
1701
|
+
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20110921112044')[0m
|
1702
|
+
[1m[35m (122.8ms)[0m commit transaction
|
1703
|
+
Migrating to RenameTranslationToNamespace (20130422115639)
|
1704
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1705
|
+
[1m[35m (0.3ms)[0m ALTER TABLE "translations" RENAME TO "rails_i18nterface_translations"
|
1706
|
+
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20130422115639')[0m
|
1707
|
+
[1m[35m (107.3ms)[0m commit transaction
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-i18nterface
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mose
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: metric_fu
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: rubocop
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|