diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 0fa0f7694dc..e037414cd96 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -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" diff --git a/config/locales/transliterate.de.yml b/config/locales/transliterate.de.yml new file mode 100644 index 00000000000..842ff6111db --- /dev/null +++ b/config/locales/transliterate.de.yml @@ -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" diff --git a/config/locales/transliterate.en.yml b/config/locales/transliterate.en.yml new file mode 100644 index 00000000000..28dd2e2e7cb --- /dev/null +++ b/config/locales/transliterate.en.yml @@ -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" diff --git a/config/locales/transliterate.ru.yml b/config/locales/transliterate.ru.yml index 25c4715b487..17a88b47fdd 100644 --- a/config/locales/transliterate.ru.yml +++ b/config/locales/transliterate.ru.yml @@ -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/ diff --git a/config/locales/transliterate.vi.yml b/config/locales/transliterate.vi.yml new file mode 100644 index 00000000000..7460eefa17b --- /dev/null +++ b/config/locales/transliterate.vi.yml @@ -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" diff --git a/lib/slug.rb b/lib/slug.rb index 8d6ab1fa6f5..61520772352 100644 --- a/lib/slug.rb +++ b/lib/slug.rb @@ -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