I did a bit more digging and found this:

https://go-review.googlesource.com/c/text/+/55331/

Which states:

"language: remove manual hr -> sr mapping was removed in CLDR for 
geo-political reasons"

Which answers why it doesn't work so I think it is just the example that 
needs removing/updating.  I think it could use "bs" (Bosnian) instead of 
"sr-Latn" and still make the point it was trying to.

On Friday, 1 March 2019 13:50:44 UTC, Iain Duncan wrote:
>
> The article for the golang.org/x/text/language here:
>
> https://blog.golang.org/matchlang
>
> states that "For a user preference of "hr" (Croatian), the best match is 
> "sr-Latn" (Serbian with Latin script), because, once they are written in 
> the same script, Serbian and Croatian are mutually intelligible." and this 
> is re-iterated in the example in the godoc here:
>
> https://godoc.org/golang.org/x/text/language#example-Matcher
>
>     fmt.Println("----")
>
>     // Someone specifying sr-Latn is probably fine with getting Croatian.
>     fmt.Println(m.Match(language.Make("sr-Latn")))
>
>     // We match SimplifiedChinese, but with Low confidence.
>     fmt.Println(m.Match(language.TraditionalChinese))
>
>     // Serbian in Latin script is a closer match to Croatian than 
> Traditional
>     // Chinese to Simplified Chinese.
>     fmt.Println(m.Match(language.TraditionalChinese, 
> language.Make("sr-Latn")))
>
> However, running either of these code examples results in Croatian not 
> being matched to Serbian and vice-versa.  This looks like a bug in the 
> language package (either in the documentation and examples or the code 
> itself) but the contribution guidelines suggested checking here first.  Has 
> the behaviour of the language package changed since that article and 
> example were written?
>
> Thanks,
>
> Iain
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to