remote_i18n_extension 1.0.8 → 1.0.9

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: 8c3bce95a44838b0a32f1185768b5455e6c096cc4a3231427512081acdf945a4
4
- data.tar.gz: 51133a49f1b9fb6f7b3381790f5f0ce246dd0729352f59c5a218102f9ee5502c
3
+ metadata.gz: 1d39598ad005dbd539128eee44e2268057997da793b9b4d02dd5e21833b2ddd3
4
+ data.tar.gz: dd65bf84f074976cec0dc388b5c7747fbd8515fe8790fc653f1b2460cbca53d0
5
5
  SHA512:
6
- metadata.gz: 3febda8ef89077970b89e7e156e1615c5c1b0f3be95d3c588b94721eee6fc88c19fe824afd86d346a6f83e71059dff95b112f5fa8f646de9c7bf3fa37f5804bd
7
- data.tar.gz: 4fa8aafc02ad43c5d1144787b4d49a845689e04061a67eaa635e9ad4a7a87bffca1e229bee62e7326f39e1412b8298309cabfd8ae26971b5c4b993ee1ea43db7
6
+ metadata.gz: e188c887f2bfd729a4052aaecf932108f74297a734944b16e4da63f60f115d07823c2b3e85688eb91f38a340c9481bd5516eac42d640d0cee9c8d3dcf66526fd
7
+ data.tar.gz: 3190ea3504cc94f43a3a7ae52933e84b6eddb246c0529ed5ae859744500096f201bf8d6ebf26cf6a1c83151db6765830745568d0fcfc235884126bc6db2602a8
data/CHANGELOG.md CHANGED
@@ -2,4 +2,9 @@
2
2
 
3
3
  ## 1.0.0 (06-May-23)
4
4
 
5
- * Initial release
5
+ * Initial release
6
+
7
+ ## 1.0.9 (09-May-23)
8
+
9
+ * Base level test coverage added
10
+ * Adds generator for configuration files
data/README.md CHANGED
@@ -1,9 +1,89 @@
1
- # Remote-I18n-Extension-Hcc
1
+ # Remote-I18n-Extension
2
2
 
3
- This gem provides an extension to the exsiting url(https://github.com/ruby-i18n/i18n)[I18n] gem by providing the ability to fetch locales from remote files
3
+ This gem is built on top of the popular [I18n](https://github.com/ruby-i18n/i18n) gem providing the ability to fetch translations from remotely hosted locale files. In case of a missing translation the gem fallbacks to serving translations from local files(present under `config/locales`) folder of your rails project.
4
4
 
5
+ ## Requirements
5
6
 
6
- # Getting Started
7
+ This gem requires `ruby 3.1.3` and `Rails 7.0.4.3`
7
8
 
8
- # Requirements
9
- This gem requires `ruby 3.1.3` and `Rails 7.0.4.3`
9
+ ## Installation
10
+ To get started paste the following inside your Gemfile and run `bundle`
11
+ ```
12
+ gem 'remote_i18n_extension', '~> 1.0', '>= 1.0.9'
13
+ ```
14
+ or install via terminal using the following command:
15
+ ```
16
+ gem install remote_i18n_extension
17
+ ```
18
+
19
+ After that run the following command to generate the config file
20
+ ```
21
+ rails g remote_i18n_extension:install
22
+ ```
23
+ This will create the following config file `config/initializers/remote_i18n_extension.rb`
24
+
25
+ ### Generated Configuration File
26
+ ```
27
+ require 'remote_i18n_extension'
28
+
29
+ RemoteI18nExtension.config do |config|
30
+ # All the configurations are mandatory
31
+
32
+ # URL to your remote locales folder housing all the translations
33
+ # For now the library expects all the locales to be stored in a single (root) folder
34
+ # e.g. https://raw.githubusercontent.com/Gooner91/locales-repo/master/locales
35
+ # config.remote_host = ENV['LOCALES_REMOTE_HOST']
36
+
37
+
38
+ # Below configurations are for the ruby I18n module
39
+
40
+ # List of available locales
41
+ # config.available_locales = [:en, :de]
42
+
43
+
44
+ # config.locale = :en
45
+
46
+ # Paths to the translation files (in your local rails project for fallback)
47
+ # e.g. Dir[Rails.root.join("config", "locales", "*.{rb,yml}")]
48
+ # config.load_path = %w[]
49
+ end
50
+
51
+ ```
52
+
53
+ ### Configurations values
54
+ #### remote_host
55
+ - base URL/URL to the folder hosting the remote files
56
+ - an example URL would be `https://raw.githubusercontent.com/Gooner91/locales-repo/master/locales` if all the translation files are uploaded in side the `locales` folder provided in the above URL
57
+ #### available_locales
58
+ - the standard I18n configuration option e.g. `%i[:en :de]`
59
+ #### locale
60
+ - the standard I18n configuration option e.g. `:en`
61
+ #### load_path
62
+ - the standard I18n configuration option e.g. ` Dir[Rails.root.join("config", "locales", "*.yml")]`
63
+
64
+ ## Usage
65
+ Fire up the server and you should be able to reference translations using the following method:
66
+ ```
67
+ RemoteI18nExtension.t('activerecord.attributes.user.confirmation_sent_at')
68
+ ```
69
+
70
+ ## Demo Video
71
+ A demo of the working of this gem can be seen on the following loom link:
72
+ https://www.loom.com/share/78825da1d74248f1b80949bf4e72b1cc
73
+
74
+ ## Constraints:
75
+
76
+ This gem facilitates fetching the `locales` that are hosted online. For that purpose the gem expects all the `locales`/`translation` files to be stored at one place.
77
+
78
+
79
+ ## Future Aspects:
80
+
81
+ Since this was a time bound activity, there are some improvments/fine tuning that can be done even further:
82
+
83
+ - Better look up support, nested file structure support for remote locales
84
+ - Increasing the overall test coverage of the gem, for now just a few basic unit test cases are added to check the behavior of the `Remote` backend, test coverage should be increased
85
+ - During testing with a demo Rails project, sometimes the gem behaves inconsistently when it comes to fallback behavior, understanding the edge cases and consistencies better and handle those as well
86
+ - Improving code quality, fixing offences pointed out by rubocop as well as properly setting up rubocop rules
87
+ - Better error handling
88
+ - Tools for measuring test coverage should be integrated i.e. simplecov
89
+ - Enforcing validation on configurations, in case some configuration is missing (raising appropriate errors)
@@ -4,8 +4,7 @@ RemoteI18nExtension.config do |config|
4
4
  # All the configurations are mandatory
5
5
 
6
6
  # URL to your remote locales folder housing all the translations
7
- # Please make sure this folder mirrors your local locales folder
8
- # to avoid fallbacks to local
7
+ # For now the library expects all the locales to be stored in a single (root) folder
9
8
  # e.g. https://raw.githubusercontent.com/Gooner91/locales-repo/master/locales
10
9
  # config.remote_host = ENV['LOCALES_REMOTE_HOST']
11
10
 
@@ -18,8 +17,7 @@ RemoteI18nExtension.config do |config|
18
17
 
19
18
  # config.locale = :en
20
19
 
21
- # Paths to the translation files
22
- # Please make sure the paths to the translation files is same for local and remote locales folder
20
+ # Paths to the translation files (in your local rails project for fallback)
23
21
  # e.g. Dir[Rails.root.join("config", "locales", "*.{rb,yml}")]
24
22
  # config.load_path = %w[]
25
23
  end
@@ -1,3 +1,3 @@
1
1
  module RemoteI18nExtension
2
- VERSION = '1.0.8'.freeze
2
+ VERSION = '1.0.9'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remote_i18n_extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hassan Ahmed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-08 00:00:00.000000000 Z
11
+ date: 2023-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n