Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helpers: Add option to transliterate content paths #11246

Closed
wants to merge 1 commit into from

Conversation

jmooring
Copy link
Member

Closes #9134

@jmooring
Copy link
Member Author

Supersedes #9135, rebasing against current master.

I am not expecting this to be merged right away. From comment on previous PR:

I'm in the process (as in: as we speak) of evaluating this whole path/URL/thing in Hugo, so I'm not merging this right right now. I agree that we probably need something like this, but it needs to wait.

@bep
Copy link
Member

bep commented Feb 5, 2024

OK, arguments from your issue re our current solution:

  1. Has no effect on non-composite characters (e.g., ß, ł, Ł)
  2. Is not language aware (e.g., for German, ä should become ae)

I haven't looked at 1. but 2. The library in question does not look very complete re. the languages it supports. A random sample testing my name in my language failed (I expected Bjoern Erik Pedersen). I understand that this is fixable, but I fail to understand the scope of that work.

package main

import (
	"fmt"

	"github.com/alexsergivan/transliterator"
)

func main() {
	trans := transliterator.NewTransliterator(nil)
	fmt.Println(trans.Transliterate("Bjørn Erik Pedersen", "nn"))
}

@jmooring
Copy link
Member Author

jmooring commented Feb 5, 2024

https://github.com/alexsergivan/transliterator/tree/master/languages

Supports nb, but not nn or no... so yes, language support is limited, with most falling back to default transliteration.

Another thing to consider with a language-specific implementation is whether to (a) base transliteration on the default content language (that's what this PR does), or (b) base transliteration on site language.

@istr
Copy link

istr commented Feb 5, 2024

For the extended version, it might be an option to use https://github.com/djimenez/iconv-go instead. This binds to the libiconv or glibc iconv functions (whatever your system provides) using cgo. As this could be considered an "extended" feature, it would make sense to provide it with full language support, but only in the extended version of hugo.

@jmooring jmooring closed this Feb 6, 2024
@jmooring jmooring deleted the feat/transliterate-paths branch February 6, 2024 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to transliterate paths
3 participants