A platform for community discussion. Free, open, simple.
FIX: Generate ASCII slug with default locale
Gerhard Schlager56f60653931c
diff --git a/lib/slug.rb b/lib/slug.rbindex 669006c2e8e..27ded2ac9f0 100644--- a/lib/slug.rb+++ b/lib/slug.rb@@ -36,7 +36,9 @@ module Slugenddef self.ascii_generator(string)- string.tr("'", "").parameterize+ I18n.with_locale(SiteSetting.default_locale) do+ string.tr("'", "").parameterize+ endenddef self.encoded_generator(string, downcase: true)diff --git a/spec/components/slug_spec.rb b/spec/components/slug_spec.rbindex 991ff235e14..99ba5a2dd8c 100644--- a/spec/components/slug_spec.rb+++ b/spec/components/slug_spec.rb@@ -46,6 +46,12 @@ describe Slug doit "fallbacks to empty string if it's too long" doexpect(Slug.for(very_long_string)).to eq(default_slug)end++ it "transliterates with the default locale" do+ SiteSetting.default_locale = :de+ I18n.locale = :en+ expect(Slug.for('löwe')).to eq('loewe')+ endendcontext 'encoded generator' do