lato 3.13.5 → 3.13.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa07b95abf829696db9d8ff107ea9fcfe03798fc160bc80f6f3bb32c609d3b55
4
- data.tar.gz: 17a4c069e82cfbb79f48e57e481445128b34d2e8e88f0c977569e84ab471ccf0
3
+ metadata.gz: 8976259317d5a079213d204026d2bd75d0795041d93a93543c85866e657181e3
4
+ data.tar.gz: 0170ce764e25e59a4bd90d978ee7e7de65df2bc0ed72ff09c89ee096eb3a7686
5
5
  SHA512:
6
- metadata.gz: 9b0548839ad403f3feb193445c8237ee06cd3f5c44b5c61a8d06f4fa70ba4ffec536533fb4e8996960e0d9e935dfe3f604ae4f84292456c1f36396e15371fff7
7
- data.tar.gz: 99d6f280cac1e467e36eb34aad42a7e026275a7a1fa2de064fcc04a1a5017016fc12b049bc223e309e42d66ee2c031ea434c7024f64a434d875f81c987553dfd
6
+ metadata.gz: 5351a5e125361250739714e88b402bc31b4378c4fae7f30d59f6e5833d45c348a21c7a4442db6ab890fb38d5087b3ec0cc2052d93d4234e0d27d9e4a735e58f2
7
+ data.tar.gz: 3e5c8e0de47bcd852d83d001cc773b2ac445daea14f4c9d92473ffa840c39fd47db4b688a8de35cdc402c7c13d9ab56f621efba5a7a0befe138ead6b92959908
data/README.md CHANGED
@@ -19,7 +19,7 @@ The gem is ready to be used with the **latest Rails 7+** features like **[ESM im
19
19
 
20
20
  ## Full documentation
21
21
 
22
- The full documentation is available at: 👉 👉 [THIS LINK](https://auuu.link/s/gh-lato) 👈 👈
22
+ The full documentation is available at: 👉 👉 [THIS LINK](https://auuu.link/s/lato) 👈 👈
23
23
 
24
24
  You can also use the [Lato AI Agent](http://lato.gregoriogalante.com/AI.html) directly on your browser to generate code and get helps with the gem.
25
25
 
@@ -27,8 +27,9 @@ module Lato
27
27
  end
28
28
 
29
29
  def switch_locale
30
- I18n.locale = params[:locale]
31
- @session.user.update(locale: params[:locale]) if @session.valid?
30
+ locale = I18n.available_locales.map(&:to_s).include?(params[:locale]) ? params[:locale] : I18n.default_locale.to_s
31
+ @session.user.update(locale: locale) if @session.valid?
32
+ cookies[:lato_locale] = { value: locale, expires: 1.year.from_now }
32
33
  respond_to_redirect_same_page
33
34
  end
34
35
 
@@ -44,9 +45,7 @@ module Lato
44
45
  # This method set the default locale for the application.
45
46
  # The default locale is the locale of the user if exists, otherwise is the default locale of the application.
46
47
  def set_default_locale
47
- return unless @session.valid?
48
-
49
- I18n.locale = @session.user&.locale || I18n.default_locale
48
+ I18n.locale = (@session.valid? ? @session.user&.locale : nil) || cookies[:lato_locale] || I18n.default_locale
50
49
  end
51
50
 
52
51
  def respond_to_redirect_same_page(notice = nil)
data/lib/lato/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lato
2
- VERSION = "3.13.5"
2
+ VERSION = "3.13.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lato
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.13.5
4
+ version: 3.13.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregorio Galante
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-28 00:00:00.000000000 Z
11
+ date: 2025-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails