i18n-edit 0.9.1 → 0.9.2
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 +4 -4
- data/README.md +18 -8
- data/app/controllers/i18n/edit/edit_controller.rb +1 -1
- data/lib/i18n/edit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3802b3756136865be2d5c0b85a3e46cfe3ff475
|
4
|
+
data.tar.gz: 994ad7604abd7c69f35ff16061b62dae0a13b261
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 825cc241291bc7d9dee948aaa3df6e60ebb43448ca757085756a26d87dcef6f54283dc9d602542a58a1635a9282bd2be41a65e415e37225d2976ae9cc6e00cff
|
7
|
+
data.tar.gz: ef36ba8ea09851705fc43665c6a355cadd72855f2d22db6fed4e035027934fd50a1e36005ea31846b6e60399a3780e642f0cc479a4166d4675a53601f3169139
|
data/README.md
CHANGED
@@ -33,22 +33,32 @@ Add this line to your routes in config/routes:
|
|
33
33
|
|
34
34
|
i18n_edit_routes
|
35
35
|
|
36
|
-
In app/views/layouts, add this line within the
|
37
|
-
|
38
|
-
|
36
|
+
In app/views/layouts, add this line within the head of your layout (or more than one
|
37
|
+
layout, depending on your project), to include the required Javascript file. Versions
|
38
|
+
for the Slim and ERB template languages are shown:
|
39
|
+
|
40
|
+
Slim version:
|
39
41
|
|
40
42
|
= i18n_edit_assets
|
41
43
|
|
44
|
+
ERB version:
|
45
|
+
|
46
|
+
<%= i18n_edit_assets %>
|
47
|
+
|
42
48
|
## How It Works
|
43
49
|
If I18N_EDIT is not set in the environment, this gem does nothing and should not
|
44
50
|
harm your application or its security. When it's set, the magic happens.
|
45
51
|
|
46
52
|
I18n.translate() is patched to emit a html-safe span containing the editable translation
|
47
|
-
text, with the contenteditable attribute set.
|
48
|
-
internationalized attributes
|
49
|
-
|
50
|
-
|
51
|
-
|
53
|
+
text, with the contenteditable attribute set. This works for internationalized texts.
|
54
|
+
It would not work for internationalized attributes of HTML nodes, because spans in
|
55
|
+
attributes don't parse. So our javascript catches all of the internationalized
|
56
|
+
attributes of HTML nodes containing our special span, removes the span from the
|
57
|
+
attribute (leaving the text), and places a special span around the HTML node which
|
58
|
+
contains the attribute instead. Javascript is used to catch events on our special spans,
|
59
|
+
which allow in-place editing and context menus. Our javascript posts requests to Rails
|
60
|
+
to update the locale text that you have edited. A controller and routes are added to
|
61
|
+
your Rails project to handle those requests.
|
52
62
|
|
53
63
|
Only locale files under the root of your rails project (rather than ones in gems, etc.)
|
54
64
|
will be edited. Locale files are replaced using the link-create-write-fsync-rename
|
data/lib/i18n/edit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n-edit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruce Perens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sysrandom
|