diff --git a/babel/messages/catalog.py b/babel/messages/catalog.py index 67c542591..7e9b7af06 100644 --- a/babel/messages/catalog.py +++ b/babel/messages/catalog.py @@ -374,6 +374,8 @@ def _get_mime_headers(self): else: headers.append(('PO-Revision-Date', self.revision_date)) headers.append(('Last-Translator', self.last_translator)) + if self.locale is not None: + headers.append(('Language', str(self.locale))) if (self.locale is not None) and ('LANGUAGE' in self.language_team): headers.append(('Language-Team', self.language_team.replace('LANGUAGE', diff --git a/tests/messages/test_catalog.py b/tests/messages/test_catalog.py index aac71eeac..31bb1d140 100644 --- a/tests/messages/test_catalog.py +++ b/tests/messages/test_catalog.py @@ -380,6 +380,7 @@ def test_catalog_mime_headers_set_locale(): ('POT-Creation-Date', '1990-04-01 15:30+0000'), ('PO-Revision-Date', '1990-08-03 12:00+0000'), ('Last-Translator', 'John Doe '), + ('Language', 'de_DE'), ('Language-Team', 'de_DE '), ('Plural-Forms', 'nplurals=2; plural=(n != 1)'), ('MIME-Version', '1.0'), diff --git a/tests/messages/test_frontend.py b/tests/messages/test_frontend.py index 882cb00d3..4d26df50e 100644 --- a/tests/messages/test_frontend.py +++ b/tests/messages/test_frontend.py @@ -359,6 +359,7 @@ def test_with_output_dir(self): "POT-Creation-Date: 2007-04-01 15:30+0200\n" "PO-Revision-Date: %(date)s\n" "Last-Translator: FULL NAME \n" +"Language: en_US\n" "Language-Team: en_US \n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" "MIME-Version: 1.0\n" @@ -409,6 +410,7 @@ def test_keeps_catalog_non_fuzzy(self): "POT-Creation-Date: 2007-04-01 15:30+0200\n" "PO-Revision-Date: %(date)s\n" "Last-Translator: FULL NAME \n" +"Language: en_US\n" "Language-Team: en_US \n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" "MIME-Version: 1.0\n" @@ -459,6 +461,7 @@ def test_correct_init_more_than_2_plurals(self): "POT-Creation-Date: 2007-04-01 15:30+0200\n" "PO-Revision-Date: %(date)s\n" "Last-Translator: FULL NAME \n" +"Language: lv_LV\n" "Language-Team: lv_LV \n" "Plural-Forms: nplurals=3; plural=(n%%10==1 && n%%100!=11 ? 0 : n != 0 ? 1 :" " 2)\n" @@ -511,6 +514,7 @@ def test_correct_init_singular_plural_forms(self): "POT-Creation-Date: 2007-04-01 15:30+0200\n" "PO-Revision-Date: %(date)s\n" "Last-Translator: FULL NAME \n" +"Language: ja_JP\n" "Language-Team: ja_JP \n" "Plural-Forms: nplurals=1; plural=0\n" "MIME-Version: 1.0\n" @@ -568,6 +572,7 @@ def test_supports_no_wrap(self): "POT-Creation-Date: 2007-04-01 15:30+0200\n" "PO-Revision-Date: %(date)s\n" "Last-Translator: FULL NAME \n" +"Language: en_US\n" "Language-Team: en_US \n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" "MIME-Version: 1.0\n" @@ -626,6 +631,7 @@ def test_supports_width(self): "POT-Creation-Date: 2007-04-01 15:30+0200\n" "PO-Revision-Date: %(date)s\n" "Last-Translator: FULL NAME \n" +"Language: en_US\n" "Language-Team: en_US \n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" "MIME-Version: 1.0\n" @@ -884,6 +890,7 @@ def test_init_with_output_dir(self): "POT-Creation-Date: 2007-04-01 15:30+0200\n" "PO-Revision-Date: %(date)s\n" "Last-Translator: FULL NAME \n" +"Language: en_US\n" "Language-Team: en_US \n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" "MIME-Version: 1.0\n" @@ -934,6 +941,7 @@ def test_init_singular_plural_forms(self): "POT-Creation-Date: 2007-04-01 15:30+0200\n" "PO-Revision-Date: %(date)s\n" "Last-Translator: FULL NAME \n" +"Language: ja_JP\n" "Language-Team: ja_JP \n" "Plural-Forms: nplurals=1; plural=0\n" "MIME-Version: 1.0\n" @@ -980,6 +988,7 @@ def test_init_more_than_2_plural_forms(self): "POT-Creation-Date: 2007-04-01 15:30+0200\n" "PO-Revision-Date: %(date)s\n" "Last-Translator: FULL NAME \n" +"Language: lv_LV\n" "Language-Team: lv_LV \n" "Plural-Forms: nplurals=3; plural=(n%%10==1 && n%%100!=11 ? 0 : n != 0 ? 1 :" " 2)\n"