FEATURE: Adds transliteration of German umlauts in slugs

- Moves the already existing transliteration rules into `transliterations.en.yml` (there's no need to translate this for every language). The same goes for the stringex configuration.
- Doesn't calculate the default slug for *zh_CN* and *ja* anymore. It hasn't been used anyway since stringex is used instead.
- Removes a wrong comment from the Russion transliteration file (I hate wrong comments)
This commit is contained in:
Gerhard Schlager
2015-02-26 21:49:24 +01:00
parent 17d07a8b9a
commit 8a236c06e2
5 changed files with 41 additions and 17 deletions

View File

@@ -4,8 +4,6 @@
module Slug
def self.for(string)
slug = string.gsub("'", "").parameterize
slug.gsub!("_", "-")
# TODO review if ja should use this
# ko asked for it to be removed
if ['zh_CN', 'ja'].include?(SiteSetting.default_locale)
@@ -13,6 +11,9 @@ module Slug
require 'stringex_lite'
end
slug = string.to_url
else
slug = string.gsub("'", "").parameterize
slug.gsub!("_", "-")
end
slug =~ /[^\d]/ ? slug : '' # Reject slugs that only contain numbers, because they would be indistinguishable from id's.
end