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

Bug with i18n & Language Code `pl` #3947

Closed
MunifTanjim opened this Issue Oct 7, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@MunifTanjim
Contributor

MunifTanjim commented Oct 7, 2017

Test Repo: https://bitbucket.org/MunifTanjim/hugo-test

Hugo Version: v0.29
OS: Ubuntu 16.04

Site Setup

/config.toml

baseURL = "http://example.org/"
title = "Hugo Test Site"

[languages.en]
lang = "en"
[languages.fr]
lang = "fr"
[languages.pl]
lang = "pl"

/i18n/en.toml

[test]
one = "test en {{ .Count }}"
other = "test en {{ .Count }}"

/i18n/pl.toml

[test]
one = "test pl {{ .Count }}"
other = "test pl {{ .Count }}"

/layouts/index.html

<!DOCTYPE html>
<html>

<head>
  <title>{{ .Site.Title }}</title>
</head>

<body>
  <p>{{ i18n "test" 1 }}</p>
  <p>{{ i18n "test" 2 }}</p>
</body>

</html>

Site Output

localhost:1313/

test en 1
test en 2

localhost:1313/pl/

test pl 1
test

Description

As you can see, the plural (i.e. other part of the i18n file) translation is not being detected when the language code is pl. But it works for any other language code.

I've reproduced the same bug with Hugo v0.28 & v0.27 too. Didn't tried with older versions than those though.

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Oct 7, 2017

Member

It is probably a duplicate of a related issue ... somewhere. There is a fix in the works, but no-one has taken the time to "do it".

Member

bep commented Oct 7, 2017

It is probably a duplicate of a related issue ... somewhere. There is a fix in the works, but no-one has taken the time to "do it".

@kzys

This comment has been minimized.

Show comment
Hide comment
@kzys

kzys Oct 10, 2017

Contributor

Polish's plural form has 4 categories (one, few, many and other) according to the Unicode spec, which seems referenced by go-i18n. So, pl.toml should have 4 entires like below.

[test]
one = "test pl {{ .Count }}"
few = "test pl {{ .Count }}"
many = "test pl {{ .Count }}"
other = "test pl {{ .Count }}"

Probably we can show more user-friendly message?

Contributor

kzys commented Oct 10, 2017

Polish's plural form has 4 categories (one, few, many and other) according to the Unicode spec, which seems referenced by go-i18n. So, pl.toml should have 4 entires like below.

[test]
one = "test pl {{ .Count }}"
few = "test pl {{ .Count }}"
many = "test pl {{ .Count }}"
other = "test pl {{ .Count }}"

Probably we can show more user-friendly message?

@MunifTanjim

This comment has been minimized.

Show comment
Hide comment
@MunifTanjim

MunifTanjim Oct 13, 2017

Contributor

Okay, this is not a bug.

Perhaps this issue should be closed.

Contributor

MunifTanjim commented Oct 13, 2017

Okay, this is not a bug.

Perhaps this issue should be closed.

@bep bep closed this Oct 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment