couch_i18n 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.rdoc +1 -2
- data/app/assets/javascripts/couch_i18n/application.js.coffee +8 -0
- data/app/assets/stylesheets/couch_i18n/application.sass +4 -0
- data/app/assets/stylesheets/couch_i18n/components/_buttons.sass +11 -0
- data/app/assets/stylesheets/couch_i18n/components/_forms.sass +45 -0
- data/app/assets/stylesheets/couch_i18n/components/_offset_navigation.sass +19 -0
- data/app/assets/stylesheets/couch_i18n/foundation_and_overrides.scss +1447 -0
- data/app/assets/stylesheets/couch_i18n/{structure.css.scss → structure.scss} +0 -24
- data/app/controllers/couch_i18n/application_controller.rb +16 -4
- data/app/controllers/couch_i18n/translations_controller.rb +37 -33
- data/app/models/couch_i18n/translation.rb +133 -26
- data/app/views/couch_i18n/application/_error_messages.html.slim +6 -0
- data/app/views/couch_i18n/translations/_form.html.slim +15 -0
- data/app/views/couch_i18n/translations/edit.html.slim +2 -0
- data/app/views/couch_i18n/translations/index.html.slim +91 -0
- data/app/views/couch_i18n/translations/new.html.slim +2 -0
- data/app/views/kaminari/couch_i18n/_first_page.html.erb +3 -0
- data/app/views/kaminari/couch_i18n/_first_page.html.slim +2 -0
- data/app/views/kaminari/couch_i18n/_gap.html.erb +3 -0
- data/app/views/kaminari/couch_i18n/_gap.html.slim +2 -0
- data/app/views/kaminari/couch_i18n/_last_page.html.erb +3 -0
- data/app/views/kaminari/couch_i18n/_last_page.html.slim +2 -0
- data/app/views/kaminari/couch_i18n/_next_page.html.erb +3 -0
- data/app/views/kaminari/couch_i18n/_next_page.html.slim +2 -0
- data/app/views/kaminari/couch_i18n/_page.html.erb +3 -0
- data/app/views/kaminari/couch_i18n/_page.html.slim +2 -0
- data/app/views/kaminari/couch_i18n/_paginator.html.erb +17 -0
- data/app/views/kaminari/couch_i18n/_paginator.html.slim +12 -0
- data/app/views/kaminari/couch_i18n/_prev_page.html.erb +3 -0
- data/app/views/kaminari/couch_i18n/_prev_page.html.slim +2 -0
- data/app/views/layouts/couch_i18n/application.html.slim +28 -0
- data/config/initializers/assets.rb +1 -0
- data/config/locales/couch_i18n.en.yml +9 -2
- data/config/routes.rb +2 -1
- data/lib/couch_i18n/active_model_errors.rb +2 -2
- data/lib/couch_i18n/backend.rb +1 -5
- data/lib/couch_i18n/engine.rb +12 -0
- data/lib/couch_i18n/store.rb +24 -12
- data/lib/couch_i18n/version.rb +3 -0
- data/lib/couch_i18n.rb +30 -9
- metadata +51 -42
- data/app/assets/javascripts/couch_i18n/application.js +0 -10
- data/app/assets/stylesheets/couch_i18n/application.css +0 -7
- data/app/assets/stylesheets/couch_i18n/bootstrap_and_override.css.less +0 -5
- data/app/views/couch_i18n/application/_error_messages.html.haml +0 -6
- data/app/views/couch_i18n/translations/_form.html.haml +0 -16
- data/app/views/couch_i18n/translations/edit.html.haml +0 -4
- data/app/views/couch_i18n/translations/index.html.haml +0 -82
- data/app/views/couch_i18n/translations/new.html.haml +0 -4
- data/app/views/layouts/couch_i18n/application.html.haml +0 -35
- /data/app/assets/stylesheets/couch_i18n/{alerts.css.scss → alerts.scss} +0 -0
- /data/app/views/couch_i18n/application/{_alerts.html.haml → _alerts.html.slim} +0 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
doctype html
|
2
|
+
html
|
3
|
+
head
|
4
|
+
title= defined?(site_title) ? site_title : I18n.t('couch_i18n.general.site_title')
|
5
|
+
/![if lt IE 9]
|
6
|
+
| <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script
|
7
|
+
= csrf_meta_tags
|
8
|
+
= stylesheet_link_tag 'couch_i18n/application'
|
9
|
+
= javascript_include_tag 'couch_i18n/application'
|
10
|
+
meta name="viewport" content="width=device-width, initial-scale=1.0"
|
11
|
+
= yield :head
|
12
|
+
body
|
13
|
+
- if defined?(Cmtool)
|
14
|
+
= render 'cmtool/application/menu'
|
15
|
+
- else
|
16
|
+
nav.top-bar data-topbar="" role="navigation"
|
17
|
+
ul.title-area
|
18
|
+
li.name
|
19
|
+
h1
|
20
|
+
a href=couch_i18n.root_path = yield :title
|
21
|
+
li.toggle-topbar.menu-icon
|
22
|
+
a href="#"
|
23
|
+
span Menu
|
24
|
+
.container
|
25
|
+
= render 'alerts'
|
26
|
+
= yield
|
27
|
+
.row: .small-12.columns
|
28
|
+
.form-actions=yield :page_links
|
@@ -0,0 +1 @@
|
|
1
|
+
Rails.application.config.assets.precompile += %w[ couch_i18n/application.css couch_i18n/application.js ]
|
@@ -13,11 +13,13 @@ en:
|
|
13
13
|
label: Translations
|
14
14
|
title: Translations
|
15
15
|
new:
|
16
|
+
title: New translation
|
16
17
|
label: New
|
17
18
|
update:
|
18
19
|
button_text: Update
|
19
20
|
successful: '%{model} is successfully updated'
|
20
21
|
create:
|
22
|
+
button_text: Add
|
21
23
|
successful: '%{model} is successfully created'
|
22
24
|
export:
|
23
25
|
execute: Execute
|
@@ -30,6 +32,7 @@ en:
|
|
30
32
|
boolean_true: 'yes'
|
31
33
|
go_to_offset: Go to offset
|
32
34
|
go_to_zero_offset: x
|
35
|
+
offset_deleted_notice: There were %{count} translations deleted having key offset %{offset}
|
33
36
|
find_part: Find key part
|
34
37
|
find_value: Find value
|
35
38
|
none_found: No translations found
|
@@ -41,6 +44,10 @@ en:
|
|
41
44
|
button: Import
|
42
45
|
label: Import
|
43
46
|
description: If you import keys, existing keys will be overwritten
|
47
|
+
notice: File imported
|
48
|
+
extension_not_valid: Please use the YAML file format for uploads
|
49
|
+
cannot_parse: The uploaded file cannot be parsed as valid translations
|
50
|
+
no_file_given: Please supply a file for upload
|
44
51
|
activemodel:
|
45
52
|
models:
|
46
53
|
couch_i18n:
|
@@ -51,6 +58,6 @@ en:
|
|
51
58
|
attributes:
|
52
59
|
couch_i18n:
|
53
60
|
translation:
|
54
|
-
|
55
|
-
|
61
|
+
translation_key: Key
|
62
|
+
translation_value: Value
|
56
63
|
translated: 'Translated?'
|
data/config/routes.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
CouchI18n::Engine.routes.draw do
|
2
2
|
root :to => "translations#index"
|
3
|
-
|
3
|
+
# allow escaped forms (%+) and unescaped forms (: ) (note the space!!) as id
|
4
|
+
resources :translations, constraints: {id: /[\w:% \.\+]+/} do
|
4
5
|
collection do
|
5
6
|
post :export
|
6
7
|
post :import
|
@@ -12,7 +12,7 @@ module ActiveModel
|
|
12
12
|
value = (attribute != :base ? @base.send(:read_attribute_for_validation, attribute) : nil)
|
13
13
|
|
14
14
|
# Create key. Remove class in model name and add errors.messages
|
15
|
-
key = (@base.class.model_name.underscore.sub(/\w+$/, '').scan(/\w+/) + ['errors.messages', type]).join('.')
|
15
|
+
key = (@base.class.model_name.to_s.underscore.sub(/\w+$/, '').scan(/\w+/) + ['errors.messages', type]).join('.')
|
16
16
|
|
17
17
|
options = {
|
18
18
|
:model => @base.class.model_name.human,
|
@@ -33,7 +33,7 @@ module ActiveModel
|
|
33
33
|
attr_name = @base.class.human_attribute_name(attribute, :default => attr_name)
|
34
34
|
|
35
35
|
# Create key. Remove class in model name and add errors.messages
|
36
|
-
key = (@base.class.model_name.underscore.sub(/\w+$/, '').scan(/\w+/) + ['errors.conjunction.attribute_message']).join('.')
|
36
|
+
key = (@base.class.model_name.to_s.underscore.sub(/\w+$/, '').scan(/\w+/) + ['errors.conjunction.attribute_message']).join('.')
|
37
37
|
I18n.t(key, {
|
38
38
|
:default => "%{attribute} %{message}",
|
39
39
|
:attribute => attr_name,
|
data/lib/couch_i18n/backend.rb
CHANGED
@@ -74,11 +74,7 @@ module CouchI18n
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def available_locales
|
77
|
-
|
78
|
-
locales.uniq!
|
79
|
-
locales.compact!
|
80
|
-
locales.map! { |k| k.to_sym }
|
81
|
-
locales
|
77
|
+
@available_locales ||= CouchI18n::Translation.get_translation_keys_by_level(0)
|
82
78
|
end
|
83
79
|
|
84
80
|
protected
|
data/lib/couch_i18n/engine.rb
CHANGED
@@ -2,5 +2,17 @@ require 'i18n'
|
|
2
2
|
module CouchI18n
|
3
3
|
class Engine < ::Rails::Engine
|
4
4
|
isolate_namespace CouchI18n
|
5
|
+
initializer 'couch_i18n.cmtool', after: 'cmtool.build_menu' do
|
6
|
+
if defined? Cmtool
|
7
|
+
require 'cmtool'
|
8
|
+
require 'couch_i18n/translation'
|
9
|
+
|
10
|
+
Cmtool::Menu.register do
|
11
|
+
append_to :site do
|
12
|
+
resource_link CouchI18n::Translation, label: :couch_i18n
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
5
17
|
end
|
6
18
|
end
|
data/lib/couch_i18n/store.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
module CouchI18n
|
2
2
|
class Store
|
3
|
+
KNOWN_DEFAULTS = {
|
4
|
+
'support.array' => %({"words_connector":", ","two_words_connector":" and ","last_word_connector":", and "})
|
5
|
+
}
|
3
6
|
|
4
7
|
def available_locales
|
5
8
|
CouchI18n::Translation.get_keys_by_level(0)
|
@@ -8,42 +11,51 @@ module CouchI18n
|
|
8
11
|
# Now the store features
|
9
12
|
def []=(key, value, options = {})
|
10
13
|
key = key.to_s.gsub('/', '.')
|
11
|
-
existing = CouchI18n::Translation.
|
12
|
-
translation = existing || CouchI18n::Translation.new(:
|
13
|
-
translation.
|
14
|
-
translation.save
|
14
|
+
existing = CouchI18n::Translation.find_by_translation_key(key) rescue nil
|
15
|
+
translation = existing || CouchI18n::Translation.new(translation_key: key)
|
16
|
+
translation.translation_value = value
|
17
|
+
translation.save and Rails.cache.write("couch_i18n-#{key}", value)
|
18
|
+
value
|
15
19
|
end
|
16
20
|
|
17
21
|
# alias for read
|
18
22
|
def [](key, options = {})
|
19
23
|
key = key.to_s.gsub('/', '.')
|
24
|
+
key_without_locale = key.sub(/\w+\./, '')
|
25
|
+
old_database_name = get_couchrest_name
|
20
26
|
Rails.cache.fetch("couch_i18n-#{key}") do
|
21
|
-
old_database_name = get_couchrest_name
|
22
27
|
begin
|
23
28
|
set_couchrest_name CouchPotato::Config.database_name # Set database to original configured name
|
24
|
-
translation = CouchI18n::Translation.
|
25
|
-
translation ||= CouchI18n::Translation.create(:
|
29
|
+
translation = CouchI18n::Translation.find_by_translation_key(key.to_s)
|
30
|
+
translation ||= CouchI18n::Translation.create(translation_key: key, translation_value: options[:default].presence || KNOWN_DEFAULTS[key_without_locale].presence || key[/\w+$/].humanize, translated: false)
|
31
|
+
#rescue SimplyStored::RecordNotFound
|
32
|
+
# binding.pry
|
26
33
|
ensure
|
27
34
|
set_couchrest_name old_database_name
|
28
35
|
end
|
29
|
-
translation.
|
36
|
+
translation.try(:translation_value)
|
30
37
|
end
|
31
38
|
end
|
32
39
|
|
33
|
-
def set_couchrest_name(
|
40
|
+
def set_couchrest_name(full_database_namename)
|
41
|
+
# we assume the database server is the same, just change the name
|
42
|
+
name = full_database_namename[/\w+$/]
|
34
43
|
d = CouchPotato.database.couchrest_database
|
35
44
|
d.instance_variable_set('@name', name)
|
36
|
-
d.instance_variable_set('@uri', "/#{name.gsub('/', '%2F')}")
|
45
|
+
#d.instance_variable_set('@uri', "/#{name.gsub('/', '%2F')}")
|
46
|
+
d.instance_variable_set('@path', "/#{CGI.escape(name)}")
|
37
47
|
d.instance_variable_set('@bulk_save_cache', [])
|
38
|
-
d.instance_variable_set('@root', d.host + d.uri)
|
48
|
+
#d.instance_variable_set('@root', d.host + d.uri)
|
49
|
+
#CouchPotato.class_variable_set('@@__couchrest_database', CouchRest.database(CouchPotato.full_url_to_database(name, CouchPotato::Config.database_host)))
|
39
50
|
end
|
40
51
|
|
41
52
|
def get_couchrest_name
|
42
53
|
CouchPotato.database.couchrest_database.name
|
43
54
|
end
|
44
55
|
|
56
|
+
#DISABLE THIS FUNCTIONALITY, IT KILLS PERFORMANCE
|
45
57
|
def keys
|
46
|
-
CouchI18n::Translation.all.map(&:
|
58
|
+
[] #@kyes ||= CouchI18n::Translation.all.map(&:translation_key)
|
47
59
|
end
|
48
60
|
end
|
49
61
|
end
|
data/lib/couch_i18n.rb
CHANGED
@@ -1,8 +1,22 @@
|
|
1
|
+
require 'couch_i18n/version'
|
1
2
|
require "couch_i18n/engine"
|
2
3
|
require 'couch_i18n/store'
|
3
4
|
require 'couch_i18n/backend'
|
4
5
|
require 'couch_i18n/active_model_errors'
|
6
|
+
|
7
|
+
# Ugly fix for the updated json gem changes
|
8
|
+
#module JSON
|
9
|
+
# class << self
|
10
|
+
# alias :old_parse :parse
|
11
|
+
# def parse(json, args = {})
|
12
|
+
# args[:create_additions] = true
|
13
|
+
# old_parse(json, args)
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
#end
|
17
|
+
|
5
18
|
module CouchI18n
|
19
|
+
@@__missing_key_handler = nil
|
6
20
|
# This method imports yaml translations to the couchdb version. When run again new ones will
|
7
21
|
# be added. Translations already stored in the couchdb database are not overwritten if true or ovveride_existing: true is given
|
8
22
|
def self.import_from_yaml(options = {})
|
@@ -18,13 +32,13 @@ module CouchI18n
|
|
18
32
|
flattened_hash = traverse_flatten_keys(yml_backend.send(:translations))
|
19
33
|
available_translations = CouchI18n::Translation.all
|
20
34
|
flattened_hash.each do |key, value|
|
21
|
-
available_translation = available_translations.find{|t| t.
|
35
|
+
available_translation = available_translations.find{|t| t.translation_key == key}
|
22
36
|
if available_translation && options[:override_existing]
|
23
|
-
available_translation.
|
37
|
+
available_translation.translation_value = value
|
24
38
|
available_translation.translated = true
|
25
39
|
available_translation.save
|
26
40
|
else
|
27
|
-
available_translation = CouchI18n::Translation.create :
|
41
|
+
available_translation = CouchI18n::Translation.create translation_key: key, translation_value: value
|
28
42
|
end
|
29
43
|
end
|
30
44
|
end
|
@@ -49,7 +63,7 @@ module CouchI18n
|
|
49
63
|
# by default all the translations are indented. So a command:
|
50
64
|
# CouchI18n.indent_keys.to_yaml will return one big yaml string of the translations
|
51
65
|
def self.indent_keys(selection = CouchI18n::Translation.all)
|
52
|
-
traverse_indent_keys(selection.map{|kv| [kv.
|
66
|
+
traverse_indent_keys(selection.map{|kv| [kv.translation_key.split('.'), kv.translation_value]})
|
53
67
|
end
|
54
68
|
|
55
69
|
# Traversing helper for indent_keys
|
@@ -66,11 +80,18 @@ module CouchI18n
|
|
66
80
|
h
|
67
81
|
end
|
68
82
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
83
|
+
def self.handle_missing_key(key)
|
84
|
+
missing_key_handler.call(key) if missing_key_handler
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.missing_key_handler
|
88
|
+
@@__missing_key_handler
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.missing_key(&blk)
|
92
|
+
raise "Assign a block to handle a missing key" unless blk.present?
|
93
|
+
raise "The missing key proc should handle the key as argument CouchI18n.missing_key{ |key| .... }" unless blk.arity == 1
|
94
|
+
@@__missing_key_handler = blk
|
74
95
|
end
|
75
96
|
end
|
76
97
|
|
metadata
CHANGED
@@ -1,46 +1,40 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couch_i18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Benjamin ter Kuile
|
9
|
-
autorequire:
|
10
8
|
bindir: bin
|
11
9
|
cert_chain: []
|
12
|
-
date:
|
10
|
+
date: 2025-08-27 00:00:00.000000000 Z
|
13
11
|
dependencies:
|
14
12
|
- !ruby/object:Gem::Dependency
|
15
13
|
name: activemodel
|
16
14
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
15
|
requirements:
|
19
|
-
- -
|
16
|
+
- - ">="
|
20
17
|
- !ruby/object:Gem::Version
|
21
18
|
version: '0'
|
22
19
|
type: :runtime
|
23
20
|
prerelease: false
|
24
21
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
22
|
requirements:
|
27
|
-
- -
|
23
|
+
- - ">="
|
28
24
|
- !ruby/object:Gem::Version
|
29
25
|
version: '0'
|
30
26
|
- !ruby/object:Gem::Dependency
|
31
27
|
name: simply_stored
|
32
28
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
29
|
requirements:
|
35
|
-
- -
|
30
|
+
- - ">="
|
36
31
|
- !ruby/object:Gem::Version
|
37
32
|
version: '0'
|
38
33
|
type: :runtime
|
39
34
|
prerelease: false
|
40
35
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
36
|
requirements:
|
43
|
-
- -
|
37
|
+
- - ">="
|
44
38
|
- !ruby/object:Gem::Version
|
45
39
|
version: '0'
|
46
40
|
description: couch_i18n is an in database storage for I18n translations, tested for
|
@@ -50,60 +44,75 @@ executables: []
|
|
50
44
|
extensions: []
|
51
45
|
extra_rdoc_files: []
|
52
46
|
files:
|
53
|
-
-
|
54
|
-
-
|
55
|
-
-
|
56
|
-
- lib/couch_i18n/store.rb
|
57
|
-
- lib/couch_i18n.rb
|
58
|
-
- lib/tasks/couch_i18n_tasks.rake
|
47
|
+
- MIT-LICENSE
|
48
|
+
- README.rdoc
|
49
|
+
- Rakefile
|
59
50
|
- app/assets/images/couch_i18n/alert.png
|
60
51
|
- app/assets/images/couch_i18n/notice.png
|
61
|
-
- app/assets/javascripts/couch_i18n/application.js
|
52
|
+
- app/assets/javascripts/couch_i18n/application.js.coffee
|
62
53
|
- app/assets/javascripts/couch_i18n/structure.js
|
63
|
-
- app/assets/stylesheets/couch_i18n/alerts.
|
64
|
-
- app/assets/stylesheets/couch_i18n/application.
|
65
|
-
- app/assets/stylesheets/couch_i18n/
|
66
|
-
- app/assets/stylesheets/couch_i18n/
|
54
|
+
- app/assets/stylesheets/couch_i18n/alerts.scss
|
55
|
+
- app/assets/stylesheets/couch_i18n/application.sass
|
56
|
+
- app/assets/stylesheets/couch_i18n/components/_buttons.sass
|
57
|
+
- app/assets/stylesheets/couch_i18n/components/_forms.sass
|
58
|
+
- app/assets/stylesheets/couch_i18n/components/_offset_navigation.sass
|
59
|
+
- app/assets/stylesheets/couch_i18n/foundation_and_overrides.scss
|
60
|
+
- app/assets/stylesheets/couch_i18n/structure.scss
|
67
61
|
- app/controllers/couch_i18n/application_controller.rb
|
68
62
|
- app/controllers/couch_i18n/translations_controller.rb
|
69
63
|
- app/helpers/couch_i18n/application_helper.rb
|
70
64
|
- app/models/couch_i18n/translation.rb
|
71
65
|
- app/models/couch_i18n/translation.rb~
|
72
|
-
- app/views/couch_i18n/application/_alerts.html.
|
73
|
-
- app/views/couch_i18n/application/_error_messages.html.
|
74
|
-
- app/views/couch_i18n/translations/_form.html.
|
75
|
-
- app/views/couch_i18n/translations/edit.html.
|
76
|
-
- app/views/couch_i18n/translations/index.html.
|
77
|
-
- app/views/couch_i18n/translations/new.html.
|
78
|
-
- app/views/
|
66
|
+
- app/views/couch_i18n/application/_alerts.html.slim
|
67
|
+
- app/views/couch_i18n/application/_error_messages.html.slim
|
68
|
+
- app/views/couch_i18n/translations/_form.html.slim
|
69
|
+
- app/views/couch_i18n/translations/edit.html.slim
|
70
|
+
- app/views/couch_i18n/translations/index.html.slim
|
71
|
+
- app/views/couch_i18n/translations/new.html.slim
|
72
|
+
- app/views/kaminari/couch_i18n/_first_page.html.erb
|
73
|
+
- app/views/kaminari/couch_i18n/_first_page.html.slim
|
74
|
+
- app/views/kaminari/couch_i18n/_gap.html.erb
|
75
|
+
- app/views/kaminari/couch_i18n/_gap.html.slim
|
76
|
+
- app/views/kaminari/couch_i18n/_last_page.html.erb
|
77
|
+
- app/views/kaminari/couch_i18n/_last_page.html.slim
|
78
|
+
- app/views/kaminari/couch_i18n/_next_page.html.erb
|
79
|
+
- app/views/kaminari/couch_i18n/_next_page.html.slim
|
80
|
+
- app/views/kaminari/couch_i18n/_page.html.erb
|
81
|
+
- app/views/kaminari/couch_i18n/_page.html.slim
|
82
|
+
- app/views/kaminari/couch_i18n/_paginator.html.erb
|
83
|
+
- app/views/kaminari/couch_i18n/_paginator.html.slim
|
84
|
+
- app/views/kaminari/couch_i18n/_prev_page.html.erb
|
85
|
+
- app/views/kaminari/couch_i18n/_prev_page.html.slim
|
86
|
+
- app/views/layouts/couch_i18n/application.html.slim
|
87
|
+
- config/initializers/assets.rb
|
79
88
|
- config/locales/couch_i18n.en.yml
|
80
89
|
- config/routes.rb
|
81
|
-
-
|
82
|
-
-
|
83
|
-
-
|
90
|
+
- lib/couch_i18n.rb
|
91
|
+
- lib/couch_i18n/active_model_errors.rb
|
92
|
+
- lib/couch_i18n/backend.rb
|
93
|
+
- lib/couch_i18n/engine.rb
|
94
|
+
- lib/couch_i18n/store.rb
|
95
|
+
- lib/couch_i18n/version.rb
|
96
|
+
- lib/tasks/couch_i18n_tasks.rake
|
84
97
|
homepage: http://github.com/bterkuile/couch_i18n
|
85
98
|
licenses: []
|
86
|
-
|
99
|
+
metadata: {}
|
87
100
|
rdoc_options: []
|
88
101
|
require_paths:
|
89
102
|
- lib
|
90
103
|
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
104
|
requirements:
|
93
|
-
- -
|
105
|
+
- - ">="
|
94
106
|
- !ruby/object:Gem::Version
|
95
107
|
version: '0'
|
96
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
109
|
requirements:
|
99
|
-
- -
|
110
|
+
- - ">="
|
100
111
|
- !ruby/object:Gem::Version
|
101
112
|
version: '0'
|
102
113
|
requirements: []
|
103
|
-
|
104
|
-
|
105
|
-
signing_key:
|
106
|
-
specification_version: 3
|
114
|
+
rubygems_version: 3.6.2
|
115
|
+
specification_version: 4
|
107
116
|
summary: couch_i18n is an in database storage for I18n translations, tested for rails,
|
108
117
|
with online management views
|
109
118
|
test_files: []
|
@@ -1,10 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
-
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
-
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
-
// the compiled file.
|
6
|
-
//
|
7
|
-
//= require jquery
|
8
|
-
//= require jquery_ujs
|
9
|
-
//= require twitter/bootstrap
|
10
|
-
//= require_directory .
|
@@ -1,7 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
-
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
-
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
-
*= require_self
|
6
|
-
*= require_directory .
|
7
|
-
*/
|
@@ -1,16 +0,0 @@
|
|
1
|
-
= form_for @translation, html: {class: 'form-horizontal'} do |f|
|
2
|
-
= render 'error_messages', :target => @translation
|
3
|
-
.control-group
|
4
|
-
= f.label :key, class: 'control-label'
|
5
|
-
.controls
|
6
|
-
= f.text_field :key, :size => 70, class: 'input-xxlarge'
|
7
|
-
.control-group
|
8
|
-
= f.label :value, class: 'control-label'
|
9
|
-
.controls
|
10
|
-
= f.text_field :value, :size => 70, class: 'input-xxlarge'
|
11
|
-
.control-group
|
12
|
-
= label_tag :is_json, t('couch_i18n.general.is_json'), class: 'control-label'
|
13
|
-
.controls
|
14
|
-
= check_box_tag :is_json, 1, f.object.value.to_s =~ /^\{|^\[/
|
15
|
-
.form-actions
|
16
|
-
= f.submit @submit || update_button_text
|
@@ -1,82 +0,0 @@
|
|
1
|
-
- if params[:offset].present?
|
2
|
-
- title params[:offset]
|
3
|
-
- else
|
4
|
-
- title t("couch_i18n.action.index.title")
|
5
|
-
- content_for :navbar do
|
6
|
-
%a.btn.btn-warning{data: {toggle: "modal"}, href: ".import-form"}= t('couch_i18n.import.label')
|
7
|
-
%a.btn.btn-success{data: {toggle: "modal"}, href: ".export-form"}= t('couch_i18n.export.label')
|
8
|
-
.pull-right
|
9
|
-
= link_to t('couch_i18n.action.destroy.offset_link'), couch_i18n.destroy_offset_translations_path(:offset => params[:offset]), :method => :delete, :confirm => (defined?(:are_you_sure) ? are_you_sure : t('couch_i18n.general.are_you_sure')), class: [:btn, 'btn-danger']
|
10
|
-
|
11
|
-
.modal.hide.import-form
|
12
|
-
= form_tag({:action => :import}, :multipart => true) do
|
13
|
-
.modal-header
|
14
|
-
%h3= t('couch_i18n.import.label')
|
15
|
-
.modal-body
|
16
|
-
%p= t('couch_i18n.import.description')
|
17
|
-
= file_field_tag :importfile
|
18
|
-
.modal-footer
|
19
|
-
%a.btn{data: {dismiss: :modal}, href: '#'}= t('couch_i18n.general.close')
|
20
|
-
= submit_tag I18n.t('couch_i18n.import.button')
|
21
|
-
.modal.hide.export-form
|
22
|
-
= form_tag :action => :export do
|
23
|
-
= hidden_field_tag :offset, params[:offset]
|
24
|
-
.modal-header
|
25
|
-
- if params[:offset].present?
|
26
|
-
%h3= t('couch_i18n.export.from_offset', offset: params[:offset])
|
27
|
-
- else
|
28
|
-
%h3= t('couch_i18n.export.label')
|
29
|
-
.modal-body
|
30
|
-
= select_tag :exportformat, options_for_select(%w[yml csv json], params[:exportformat])
|
31
|
-
= check_box_tag :untranslated
|
32
|
-
= label_tag :untranslated, t('couch_i18n.export.untranslated'), class: 'untranslated-label'
|
33
|
-
.modal-footer
|
34
|
-
%a.btn{data: {dismiss: :modal}, href: '#'}= t('couch_i18n.general.close')
|
35
|
-
= submit_tag I18n.t('couch_i18n.export.execute')
|
36
|
-
.offset-navigation-block.block
|
37
|
-
.btn-toolbar
|
38
|
-
- for offset in @available_higher_offsets
|
39
|
-
.btn-group
|
40
|
-
= link_to offset[:name], {:offset => offset[:offset], untranslated: params[:untranslated]}, class: :btn
|
41
|
-
.offset-navigation-form
|
42
|
-
= form_tag({}, :method => :get )do
|
43
|
-
- if params[:offset].present?
|
44
|
-
= link_to I18n.t('couch_i18n.general.go_to_zero_offset'), :offset => nil
|
45
|
-
= text_field_tag :offset, params[:offset], :size => 60
|
46
|
-
= "(#{@translations.total_count})"
|
47
|
-
%input{:type => :submit, :name => :commit, :value => I18n.t('couch_i18n.general.go_to_offset')}
|
48
|
-
%input{:type => :submit, :name => :partfinder, :value => I18n.t('couch_i18n.general.find_part')}
|
49
|
-
%input{:type => :submit, :name => :valuefinder, :value => I18n.t('couch_i18n.general.find_value')}
|
50
|
-
= check_box_tag :untranslated, 1, untranslated?, id: :untranslated_listing
|
51
|
-
= label_tag :untranslated_listing, I18n.t('couch_i18n.general.untranslated_label'), class: 'untranslated-label'
|
52
|
-
.btn-toolbar
|
53
|
-
- for offset in @available_deeper_offsets
|
54
|
-
.btn-group
|
55
|
-
= link_to(offset[:name], {:offset => offset[:offset], untranslated: params[:untranslated]}, class: :btn)
|
56
|
-
- if @translations.any?
|
57
|
-
= paginate @translations, :right => 3, :left => 3
|
58
|
-
%table.table.table-striped
|
59
|
-
%thead
|
60
|
-
%tr
|
61
|
-
%th= CouchI18n::Translation.human_attribute_name(:key)
|
62
|
-
%th= CouchI18n::Translation.human_attribute_name(:value)
|
63
|
-
%th= CouchI18n::Translation.human_attribute_name(:translated)
|
64
|
-
%th.action.edit
|
65
|
-
%th.action.destroy
|
66
|
-
%tbody
|
67
|
-
- @translations.each do |translation|
|
68
|
-
%tr{:class => cycle('odd', 'even')}
|
69
|
-
%td
|
70
|
-
- if partfinder? || valuefinder?
|
71
|
-
= link_to translation.key.sub(/^\./, ''), couch_i18n.edit_translation_path(translation)
|
72
|
-
- else
|
73
|
-
= link_to translation.key[(params[:offset].try(:size) || 0)..-1].sub(/^\./, ''), couch_i18n.edit_translation_path(translation)
|
74
|
-
%td= link_to translation.value, couch_i18n.edit_translation_path(translation)
|
75
|
-
%td.boolean= boolean_show(translation.translated)
|
76
|
-
%td.action.edit= link_to link_to_edit_content(translation), couch_i18n.edit_translation_path(translation), class: [:btn]
|
77
|
-
%td.action.destroy= link_to link_to_destroy_content(translation),couch_i18n.translation_path(translation), :confirm => are_you_sure, :method => :delete, class: [:btn, 'btn-danger']
|
78
|
-
- else
|
79
|
-
%h3= t("couch_i18n.general.none_found")
|
80
|
-
|
81
|
-
- content_for :page_links do
|
82
|
-
= link_to link_to_new_content(:translation), couch_i18n.new_translation_path(:offset => params[:offset])
|
@@ -1,35 +0,0 @@
|
|
1
|
-
!!!
|
2
|
-
%html
|
3
|
-
%head
|
4
|
-
%title= defined?(site_title) ? site_title : I18n.t('couch_i18n.general.site_title')
|
5
|
-
/[if lt IE 9]
|
6
|
-
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
|
7
|
-
= csrf_meta_tags
|
8
|
-
= stylesheet_link_tag 'couch_i18n/application'
|
9
|
-
= javascript_include_tag 'couch_i18n/application'
|
10
|
-
%meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0"}
|
11
|
-
= yield :head
|
12
|
-
%body
|
13
|
-
.navbar.navbar-fixed-top
|
14
|
-
.navbar-inner
|
15
|
-
.container
|
16
|
-
%a.btn.btn-navbar{data: {toggle: "collapse", target: ".nav-collapse"}}
|
17
|
-
%span.icon-bar
|
18
|
-
%span.icon-bar
|
19
|
-
%span.icon-bar
|
20
|
-
%a.brand{href: couch_i18n.root_path}= yield :title
|
21
|
-
-#.nav-collapse
|
22
|
-
%ul.nav
|
23
|
-
%li= link_to 'Clear', couch_i18n.root_path
|
24
|
-
= yield :navbar
|
25
|
-
.container
|
26
|
-
= render 'alerts'
|
27
|
-
= yield
|
28
|
-
|
29
|
-
-#page-wrapper
|
30
|
-
#page-header
|
31
|
-
%h1= yield :title
|
32
|
-
#page-content
|
33
|
-
= render 'alerts'
|
34
|
-
= yield
|
35
|
-
#page-links= yield :page_links
|
File without changes
|
File without changes
|