Skip to content

Commit afbdf5b

Browse files
committed
Make lang configurable
1 parent fb8296e commit afbdf5b

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
##
2+
* make site lang configurable
3+
14
## v4.0.x-20241022
25
* add regex support for domain
36

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ LOCOMOTIVE_ADMIN_SSL_REDIRECT=[true|false] (default: true)
8484
```
8585
Force redirection of admin backend to HTTPS.
8686

87+
### LOCOMOTIVE_SITE_ALLOWED_LOCALES
88+
89+
LOCOMOTIVE_SITE_ALLOWED_LOCALES="fr,ca,es"
90+
91+
Note: be carefull if you add too many lang (more than 7) you can reach some index limitation on mongodb
92+
93+
If not defined then allowed lang are the following: "en,de,fr,es,pt,it,nl"
8794

8895
## RAILS configuration
8996

shopinvader/config/initializers/locomotive.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@
2323
config.locales = [:en, :fr, :de, :"zh-CN", :cs, :el, :lt, :"pt-BR", :nl, :ru, :it]
2424

2525
# available locales suggested to "localize" a site. You will have to pick up at least one among that list.
26-
# config.site_locales = %w{en de fr pl pt pt-BR it nl nb es ru ja cs bg sk uk}
2726
# sadly mongodb have index limitation we need to restrict the index used here
28-
# TODO we should make it configurable and take the time to document this limitation
29-
config.site_locales = %w{en de fr es pt it nl}
27+
if ENV["LOCOMOTIVE_SITE_ALLOWED_LOCALES"].present?
28+
config.site_locales = ENV["LOCOMOTIVE_SITE_ALLOWED_LOCALES"].split(",")
29+
else
30+
config.site_locales = %w{en de fr es pt it nl}
31+
end
3032

3133
# tell if logs of the Engine (back-office) are enabled. Useful for debug purpose.
3234
config.enable_logs = true

0 commit comments

Comments
 (0)