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:
parent
17d07a8b9a
commit
8a236c06e2
|
@ -15,18 +15,6 @@
|
|||
# http://yamllint.com/
|
||||
|
||||
en:
|
||||
stringex:
|
||||
characters:
|
||||
ellipsis: ""
|
||||
number: "-"
|
||||
# some default transliteration rules may be missing, add them to your locale
|
||||
i18n:
|
||||
transliterate:
|
||||
rule:
|
||||
ț: "t"
|
||||
Ț: "t"
|
||||
ș: "s"
|
||||
Ș: "s"
|
||||
dates:
|
||||
short_date_no_year: "D MMM"
|
||||
short_date: "D MMM, YYYY"
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# encoding: utf-8
|
||||
#
|
||||
# This file contains transliteration rules for German
|
||||
#
|
||||
# To validate this YAML file after you change it, please paste it into
|
||||
# http://yamllint.com/
|
||||
|
||||
de:
|
||||
i18n:
|
||||
transliterate:
|
||||
rule:
|
||||
Ä: "Ae"
|
||||
Ö: "Oe"
|
||||
Ü: "Ue"
|
||||
ß: "ss"
|
||||
ä: "ae"
|
||||
ö: "oe"
|
||||
ü: "ue"
|
|
@ -0,0 +1,20 @@
|
|||
# encoding: utf-8
|
||||
#
|
||||
# This file contains default transliteration rules and configures stringex
|
||||
#
|
||||
# To validate this YAML file after you change it, please paste it into
|
||||
# http://yamllint.com/
|
||||
|
||||
en:
|
||||
stringex:
|
||||
characters:
|
||||
ellipsis: ""
|
||||
number: "-"
|
||||
# some default transliteration rules may be missing, add them to your locale
|
||||
i18n:
|
||||
transliterate:
|
||||
rule:
|
||||
ț: "t"
|
||||
Ț: "t"
|
||||
ș: "s"
|
||||
Ș: "s"
|
|
@ -2,9 +2,6 @@
|
|||
# This file contains content for the i18n transliteration map from
|
||||
# Russian Cyrillic to ASCII (ISO-9:1995 / GOST 7.79-2000, table B)
|
||||
#
|
||||
# To work with us on translations, see:
|
||||
# https://www.transifex.com/projects/p/discourse-pt-br/
|
||||
#
|
||||
# To validate this YAML file after you change it, please paste it into
|
||||
# http://yamllint.com/
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue