Merge pull request #3244 from gschlager/german_umlauts

FEATURE: Adds transliteration of German umlauts in slugs
This commit is contained in:
Sam 2015-03-02 10:19:30 +11:00
commit 79249a8d5f
6 changed files with 189 additions and 17 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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/

View File

@ -0,0 +1,148 @@
# encoding: utf-8
#
# This file contains transliteration rules for Vietnamese
#
# To validate this YAML file after you change it, please paste it into
# http://yamllint.com/
vi:
i18n:
transliterate:
rule:
à: "a"
á: "a"
: "a"
: "a"
ã: "a"
â: "a"
: "a"
: "a"
: "a"
: "a"
: "a"
ă: "a"
: "a"
: "a"
: "a"
: "a"
: "a"
è: "e"
é: "e"
: "e"
: "e"
: "e"
ê: "e"
: "e"
ế: "e"
: "e"
: "e"
: "e"
ì: "i"
í: "i"
: "i"
: "i"
ĩ: "i"
ò: "o"
ó: "o"
: "o"
: "o"
õ: "o"
ô: "o"
: "o"
: "o"
: "o"
: "o"
: "o"
ơ: "o"
: "o"
: "o"
: "o"
: "o"
: "o"
ù: "u"
ú: "u"
: "u"
: "u"
ũ: "u"
ư: "u"
: "u"
: "u"
: "u"
: "u"
: "u"
: "y"
ý: "y"
: "y"
: "y"
: "y"
đ: "d"
À: "A"
Á: "A"
: "A"
: "A"
Ã: "A"
Â: "A"
: "A"
: "A"
: "A"
: "A"
: "A"
Ă: "A"
: "A"
: "A"
: "A"
: "A"
: "A"
È: "E"
É: "E"
: "E"
: "E"
: "E"
Ê: "E"
: "E"
: "E"
: "E"
: "E"
: "E"
Ì: "I"
Í: "I"
: "I"
: "I"
Ĩ: "I"
Ò: "O"
Ó: "O"
: "O"
: "O"
Õ: "O"
Ô: "O"
: "O"
: "O"
: "O"
: "O"
: "O"
Ơ: "O"
: "O"
: "O"
: "O"
: "O"
: "O"
Ù: "U"
Ú: "U"
: "U"
: "U"
Ũ: "U"
Ư: "U"
: "U"
: "U"
: "U"
: "U"
: "U"
: "Y"
Ý: "Y"
: "Y"
: "Y"
: "Y"
Đ: "D"
ê: "e"
ù: "u"
à: "a"

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