如何在 Drupal 中强制使用仅 ASCII 的 url?

发布于 2024-12-01 23:08:15 字数 378 浏览 2 评论 0原文

在带有 PathAuto 的 Drupal 7 网站中:

在 pathAuto 设置中,我有类似“[term:vocabulary]/[term:name]”的内容作为许多类别中的模式,但因为词汇、分类等名称不是英文的,所以我有包含非 ASCII 字符的 url。这还不错,但在 IE 中很难看(比如 Portal/%CE%B5%CE%BC%CE%B2%CE 等。

我可以使用机器名称而不是名称或词汇,但我想要更好的东西。

在 WordPress 中,有一些插件可以清理 url,我正在使用它们来用 ascii 字符替换非 ascii 字符(例如希腊语中的 α -> a、π -> p 等等)

我怎么能在 Drupal 中出现这样的行为呢?

in a Drupal 7 with PathAuto website:

In pathAuto settings I have something like "[term:vocabulary]/[term:name]" as a pattern in many categories, but because the vocabulary, taxonomy, etc names are not in English I have urls that contain non ascii characters. This is not bad but in IE is ugly (something like Portal/%CE%B5%CE%BC%CE%B2%CE etc.

I could use the machine name instead of the name or vocabulary, but I want something better.

In wordpress there are plugins that sanitize the url and I am using them in order to replace non ascii with ascii characters (eg α -> a, π -> p in greek, and so on)

How can I have such behavior in Drupal?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

2024-12-08 23:08:16

解决方案是 音译 模块。

提供单向字符串音译(罗马化),并在上传过程中通过替换不需要的字符来清理文件名。

一般来说,它采用 Unicode 文本,并通过尝试将其他书写系统中的文本表达的发音音译为罗马字母,尝试用 US-ASCII 字符(通用可显示的无重音字符)来表示它。

该模块由 PathAuto 模块支持。

对于 Pathauto 6.x-2.x:如果您的网站可能包含字符,音译很有用超出 ASCII 128,并且您希望将它们音译为 ASCII 128。(对于 Pathauto 6.x-1.x,该功能由 Pathauto 模块处理,请参阅 README.txt 了解更多详细信息)。

The solution is the Transliteration module.

Provides one-way string transliteration (romanization) and cleans file names during upload by replacing unwanted characters.

Generally spoken, it takes Unicode text and tries to represent it in US-ASCII characters (universally displayable, unaccented characters) by attempting to transliterate the pronunciation expressed by the text in some other writing system to Roman letters.

The module is supported by the PathAuto module.

For Pathauto 6.x-2.x: Transliteration is useful if your site is likely contain characters beyond ASCII 128 and you want them transliterated into ASCII 128. (For Pathauto 6.x-1.x that feature is handled by the Pathauto module, see the README.txt for more details).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文