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

@ -15,18 +15,6 @@
# http://yamllint.com/ # http://yamllint.com/
en: 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: dates:
short_date_no_year: "D MMM" short_date_no_year: "D MMM"
short_date: "D MMM, YYYY" 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 # This file contains content for the i18n transliteration map from
# Russian Cyrillic to ASCII (ISO-9:1995 / GOST 7.79-2000, table B) # 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 # To validate this YAML file after you change it, please paste it into
# http://yamllint.com/ # http://yamllint.com/

View File

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