diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-11-28 13:00:49 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-11-28 13:00:49 +0000 |
commit | 49b932b3eed546752819ec9f286aa8de79eb2813 (patch) | |
tree | 62b2746279ad31249a83035c7c77d580725662c4 | |
parent | eac295b32d8b135b4aa19a868183fa1591ff0f89 (diff) |
Add a configuration option to specify that you don't want the default locale to appear in URLs generated by the application.
-rw-r--r-- | config/general.yml-example | 4 | ||||
-rw-r--r-- | config/initializers/fast_gettext.rb | 4 | ||||
-rw-r--r-- | lib/configuration.rb | 1 |
3 files changed, 8 insertions, 1 deletions
diff --git a/config/general.yml-example b/config/general.yml-example index fd134b0c2..bfe289541 100644 --- a/config/general.yml-example +++ b/config/general.yml-example @@ -32,6 +32,10 @@ AVAILABLE_LOCALES: 'en es' DEFAULT_LOCALE: 'en' USE_DEFAULT_BROWSER_LANGUAGE: true +# If you don't want the default locale to be included in URLs generated +# by the application, set this to false +INCLUDE_DEFAULT_LOCALE_IN_URLS: true + # How many days should have passed before an answer to a request is officially late? REPLY_LATE_AFTER_DAYS: 20 REPLY_VERY_LATE_AFTER_DAYS: 40 diff --git a/config/initializers/fast_gettext.rb b/config/initializers/fast_gettext.rb index 2ecf5cb5d..55d05fcaf 100644 --- a/config/initializers/fast_gettext.rb +++ b/config/initializers/fast_gettext.rb @@ -3,4 +3,6 @@ FastGettext.default_text_domain = 'app' I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks) - +if Configuration::include_default_locale_in_urls == false + RoutingFilter::Locale.include_default_locale = false +end
\ No newline at end of file diff --git a/lib/configuration.rb b/lib/configuration.rb index abd0f5cdc..11fe1c56e 100644 --- a/lib/configuration.rb +++ b/lib/configuration.rb @@ -25,6 +25,7 @@ module Configuration :GA_CODE => '', :GAZE_URL => '', :HTML_TO_PDF_COMMAND => '', + :INCLUDE_DEFAULT_LOCALE_IN_URLS => true, :INCOMING_EMAIL_DOMAIN => 'localhost', :INCOMING_EMAIL_PREFIX => '', :INCOMING_EMAIL_SECRET => 'dummysecret', |