-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from felixonmars/master
Support 'Language' header field of PO files
- Loading branch information
Showing
3 changed files
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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', | ||
|
@@ -457,6 +459,7 @@ def _set_mime_headers(self, headers): | |
POT-Creation-Date: 1990-04-01 15:30+0000 | ||
PO-Revision-Date: 1990-08-03 12:00+0000 | ||
Last-Translator: John Doe <[email protected]> | ||
Language: de_DE | ||
Language-Team: de_DE <[email protected]> | ||
Plural-Forms: nplurals=2; plural=(n != 1) | ||
MIME-Version: 1.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]>'), | ||
('Language', 'de_DE'), | ||
('Language-Team', 'de_DE <[email protected]>'), | ||
('Plural-Forms', 'nplurals=2; plural=(n != 1)'), | ||
('MIME-Version', '1.0'), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <EMAIL@ADDRESS>\n" | ||
"Language: en_US\n" | ||
"Language-Team: en_US <[email protected]>\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 <EMAIL@ADDRESS>\n" | ||
"Language: en_US\n" | ||
"Language-Team: en_US <[email protected]>\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 <EMAIL@ADDRESS>\n" | ||
"Language: lv_LV\n" | ||
"Language-Team: lv_LV <[email protected]>\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 <EMAIL@ADDRESS>\n" | ||
"Language: ja_JP\n" | ||
"Language-Team: ja_JP <[email protected]>\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 <EMAIL@ADDRESS>\n" | ||
"Language: en_US\n" | ||
"Language-Team: en_US <[email protected]>\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 <EMAIL@ADDRESS>\n" | ||
"Language: en_US\n" | ||
"Language-Team: en_US <[email protected]>\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 <EMAIL@ADDRESS>\n" | ||
"Language: en_US\n" | ||
"Language-Team: en_US <[email protected]>\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 <EMAIL@ADDRESS>\n" | ||
"Language: ja_JP\n" | ||
"Language-Team: ja_JP <[email protected]>\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 <EMAIL@ADDRESS>\n" | ||
"Language: lv_LV\n" | ||
"Language-Team: lv_LV <[email protected]>\n" | ||
"Plural-Forms: nplurals=3; plural=(n%%10==1 && n%%100!=11 ? 0 : n != 0 ? 1 :" | ||
" 2)\n" | ||
|