i18n_screwdriver 10.4.0 → 10.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a43291b108aebb365346f9b4ca32f5c388a677d02a03e27aa20d34e66cdb3c0
4
- data.tar.gz: c6ea9f516c31f7ae8ffe207911e5d9db4bbbd8417cf2820e6411a20642676d6c
3
+ metadata.gz: e516acf75a0c358ecb8e44259212d6c087b8658441a7d8f75d9120587225fc06
4
+ data.tar.gz: ba1062edcb8289196912a3e0208d6587561f75bbf688cd02eda6e52b352e1e74
5
5
  SHA512:
6
- metadata.gz: 8c6f1d3ca48cea9467d46563bf751a1da74cd62e449ef17a7323a45b889b8cc2bf712d9a1829da298c560ef61f2a0966ba93de267d10ccc3b974d6b9268d16fd
7
- data.tar.gz: 898f9916a96d363f721c34121634946d38ff3ef236b9722b6433b139007a136616ebb7ad18f1af28aa02efe987f07b92269ecc831bf45831dd812c96e9077c1d
6
+ metadata.gz: 5daec9475659b384b3526e29291bb3df3e40df601f6ee35595249defa6531edb276cf9fbfaa56fbfcb85d50d4b57cc32ffbe6e9089d950fb1c9b213f2089a3e0
7
+ data.tar.gz: db8f74bbd26f5c5da0c5bc2d3d3639ae151ee3296f31e891ca45052b6803b45d6416f6b93ee58149828a8895ecb1203df35991a368a15da9fc235638920fd29e
@@ -0,0 +1,5 @@
1
+ I18n.locale = document.querySelector("html").getAttribute("lang");
2
+ if (I18n.onMissingTranslation == null) {
3
+ I18n.onMissingTranslation = (md5, message) =>
4
+ `translation missing: ${I18n.locale}.${message}`;
5
+ }
@@ -0,0 +1,13 @@
1
+ //= require i18n_screwdriver/md5
2
+
3
+ const interpolate = (message, data) =>
4
+ message.replace(/%{([^{}]*)}/g, (a, b) => data[b]);
5
+
6
+ I18n.screw = function(message, data) {
7
+ const md5 = window.md5(message);
8
+ let translation = I18n.translations[I18n.locale][md5];
9
+ if (translation == null) {
10
+ translation = I18n.onMissingTranslation(md5, message);
11
+ }
12
+ return interpolate(translation, data);
13
+ };
@@ -1,3 +1,3 @@
1
1
  module I18nScrewdriver
2
- VERSION = "10.4.0"
2
+ VERSION = "10.5.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_screwdriver
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.4.0
4
+ version: 10.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Miesel
@@ -69,9 +69,9 @@ files:
69
69
  - LICENSE.txt
70
70
  - README.rdoc
71
71
  - Rakefile
72
- - app/assets/javascrips/i18n_screwdriver/config.coffee
72
+ - app/assets/javascrips/i18n_screwdriver/config.js
73
73
  - app/assets/javascrips/i18n_screwdriver/md5.js
74
- - app/assets/javascrips/i18n_screwdriver/screw.coffee
74
+ - app/assets/javascrips/i18n_screwdriver/screw.js
75
75
  - docker-compose.yml
76
76
  - i18n_screwdriver.gemspec
77
77
  - lib/i18n_screwdriver.rb
@@ -1,3 +0,0 @@
1
- I18n.locale = $("html").attr("lang")
2
- I18n.onMissingTranslation ?= (md5, message) ->
3
- "translation missing: #{I18n.locale}.#{message}"
@@ -1,10 +0,0 @@
1
- #= require i18n_screwdriver/md5
2
-
3
- interpolate = (message, data) ->
4
- message.replace(/%{([^{}]*)}/g, (a, b) -> data[b])
5
-
6
- I18n.screw = (message, data) ->
7
- md5 = window.md5(message)
8
- translation = I18n.translations[I18n.locale][md5]
9
- translation ?= I18n.onMissingTranslation(md5, message)
10
- interpolate(translation, data)