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

Support special string operations for Turkish and Azeri languages #10147

Open
doganulus opened this issue Aug 3, 2022 · 4 comments
Open

Support special string operations for Turkish and Azeri languages #10147

doganulus opened this issue Aug 3, 2022 · 4 comments

Comments

@doganulus
Copy link

doganulus commented Aug 3, 2022

Turkish tr and Azeri az languages distinguish dotted and dotless i and I in their typesetting. For the correct typesetting in these languages, we need to convert lowercase dotted i to uppercase dotted İ (for upper) and uppercase dotless I to lowercase dotless ı (for lower).

Golang already supports the special string mappings for these languages using the functions:

Adding this feature to Hugo will improve Turkish and Azeri language support.

@bep
Copy link
Member

bep commented Aug 3, 2022

According to the Godoc of https://pkg.go.dev/strings#ToLowerSpecial

ToTitleSpecial returns a copy of the string s with all Unicode letters mapped to their Unicode title case, giving priority to the special casing rules.

Where do we get the "special casing rules" for a given language?

@doganulus
Copy link
Author

doganulus commented Aug 3, 2022

I think they are already implemented in the unicode package as unicode.TurkishCase and unicode.AzeriCase. Those are the only ones having special casing rules and implemented as such.

Besides the functions in the strings package, the documentation here also gives the following example.

package main

import (
	"fmt"
	"unicode"
)

func main() {
	t := unicode.TurkishCase

	const lci = 'i'
	fmt.Printf("%#U\n", t.ToLower(lci))
	fmt.Printf("%#U\n", t.ToTitle(lci))
	fmt.Printf("%#U\n", t.ToUpper(lci))

	const uci = 'İ'
	fmt.Printf("%#U\n", t.ToLower(uci))
	fmt.Printf("%#U\n", t.ToTitle(uci))
	fmt.Printf("%#U\n", t.ToUpper(uci))
}

And the output is:

U+0069 'i'
U+0130 'İ'
U+0130 'İ'
U+0069 'i'
U+0130 'İ'
U+0130 'İ'

Copy link

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@github-actions github-actions bot added the Stale label May 30, 2024
@doganulus
Copy link
Author

This is a relevant feature for increasing Hugo i18n support.

@github-actions github-actions bot removed the Stale label Jun 1, 2024
@bep bep removed the NeedsTriage label Jul 22, 2024
@bep bep added this to the v0.131.0 milestone Jul 22, 2024
@bep bep modified the milestones: v0.131.0, v0.133.0 Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants