Hugo: Bug with i18n & Language Code `pl`

Created on 7 Oct 2017  路  3Comments  路  Source: gohugoio/hugo

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.

Most helpful comment

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?

All 3 comments

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".

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?

Okay, this is not a bug.

Perhaps this issue should be closed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ianbrandt picture ianbrandt  路  3Comments

VoidingWarranties picture VoidingWarranties  路  3Comments

artelse picture artelse  路  3Comments

kaushalmodi picture kaushalmodi  路  3Comments

mumblecrunch picture mumblecrunch  路  3Comments