preciousss 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -0
- data/lib/preciousss/controllers/helpers.rb +22 -0
- data/lib/preciousss/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -58,6 +58,28 @@ module Preciousss
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
private ########################################################################################################
|
62
|
+
|
63
|
+
# Get locale from top-level domain or return nil if such locale is not available
|
64
|
+
# You have to put something like:
|
65
|
+
# 127.0.0.1 application.com
|
66
|
+
# 127.0.0.1 application.it
|
67
|
+
# 127.0.0.1 application.pl
|
68
|
+
# in your /etc/hosts file to try this out locally
|
69
|
+
def extract_locale_from_tld
|
70
|
+
locale = request.host.split('.').last
|
71
|
+
!locale.blank? && I18n.available_locales.include?(locale.to_sym) ? locale : nil
|
72
|
+
end
|
73
|
+
|
74
|
+
# Get locale code from request subdomain (like http://it.application.local:3000)
|
75
|
+
# You have to put something like:
|
76
|
+
# 127.0.0.1 gr.application.local
|
77
|
+
# in your /etc/hosts file to try this out locally
|
78
|
+
def extract_locale_from_subdomain
|
79
|
+
locale = request.subdomains.first
|
80
|
+
!locale.blank? && I18n.available_locales.include?(locale.to_sym) ? locale : nil
|
81
|
+
end
|
82
|
+
|
61
83
|
end
|
62
84
|
|
63
85
|
end
|
data/lib/preciousss/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: preciousss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 10
|
10
|
+
version: 0.0.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- sodercober
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-30 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|