-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better accommodations for reading non-UTF-8 PO files
Instead of reading the whole file and only then checking the charset, read just up to the first msgid/msgstr, check if it specifies a charset right away. If it does, imbue the file with the correct charset and read the rest. In particular this: - Avoid unnecessary warnings - Avoid reading the file repeatedly Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
- Loading branch information
Showing
10 changed files
with
233 additions
and
17 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
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
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# SOME DESCRIPTIVE TITLE | ||
# Copyright (C) YEAR Free Software Foundation, Inc. | ||
# This file is distributed under the same license as the PACKAGE package. | ||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | ||
# | ||
#, fuzzy | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: PACKAGE VERSION\n" | ||
"POT-Creation-Date: 2024-10-29 00:02+0300\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <LL@li.org>\n" | ||
"Language: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
|
||
#. type: =head1 | ||
#: utf8.pod:1 | ||
msgid "ASCII-utf8-title" | ||
msgstr "" | ||
|
||
#. type: textblock | ||
#: utf8.pod:3 iso8859.pod:3 | ||
msgid "common string with diactricks: é ê è â" | ||
msgstr "" | ||
|
||
#. type: textblock | ||
#: utf8.pod:5 | ||
msgid "utf8 string with diactricks: é ê è â" | ||
msgstr "" | ||
|
||
#. type: =head1 | ||
#: iso8859.pod:1 | ||
msgid "ASCII-iso8859-title" | ||
msgstr "" | ||
|
||
#. type: textblock | ||
#: iso8859.pod:5 | ||
msgid "iso8859 string with diactricks: é ê è â" | ||
msgstr "" |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
=head1 ASCII-iso8859-title | ||
|
||
common string with diactricks: � � � � | ||
|
||
iso8859 string with diactricks: � � � � |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Language up translations for po-iso package | ||
# Copyright (C) 2024 Free Software Foundation, Inc. | ||
# This file is distributed under the same license as the po-iso package. | ||
# A comment with diactricks: é ê è | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: po-iso 8859\n" | ||
"POT-Creation-Date: 2024-10-29 00:02+0300\n" | ||
"PO-Revision-Date: 2024-10-29 00:02+0300\n" | ||
"Last-Translator: À Déâctrîc Pérsôn\n" | ||
"Language-Team: none\n" | ||
"Language: up\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=iso-8859-1\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
|
||
#. type: =head1 | ||
#: utf8.pod:1 | ||
msgid "ASCII-utf8-title" | ||
msgstr "ASCII-UTF8-TITLE" | ||
|
||
#. type: textblock | ||
#: utf8.pod:3 iso8859.pod:3 | ||
msgid "common string with diactricks: é ê è â" | ||
msgstr "COMMON STRING WITH DIACTRICKS: É Ê È Â" | ||
|
||
#. type: textblock | ||
#: utf8.pod:5 | ||
msgid "utf8 string with diactricks: é ê è â" | ||
msgstr "UTF8 STRING WITH DIACTRICKS: É Ê È Â" | ||
|
||
#. type: =head1 | ||
#: iso8859.pod:1 | ||
msgid "ASCII-iso8859-title" | ||
msgstr "ASCII-ISO8859-TITLE" | ||
|
||
#. type: textblock | ||
#: iso8859.pod:5 | ||
msgid "iso8859 string with diactricks: é ê è â" | ||
msgstr "ISO8859 STRING WITH DIACTRICKS: É Ê È Â" |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Language up translations for po-iso package | ||
# Copyright (C) 2024 Free Software Foundation, Inc. | ||
# This file is distributed under the same license as the po-iso package. | ||
# Automatically generated, 2024. | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: po-iso 8859\n" | ||
"POT-Creation-Date: 2024-10-29 00:02+0300\n" | ||
"PO-Revision-Date: 2024-10-29 00:02+0300\n" | ||
"Last-Translator: Automatically generated\n" | ||
"Language-Team: none\n" | ||
"Language: up\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
|
||
#. type: =head1 | ||
#: utf8.pod:1 | ||
msgid "ASCII-utf8-title" | ||
msgstr "" | ||
|
||
#. type: textblock | ||
#: utf8.pod:3 iso8859.pod:3 | ||
msgid "common string with diactricks: é ê è â" | ||
msgstr "" | ||
|
||
#. type: textblock | ||
#: utf8.pod:5 | ||
msgid "utf8 string with diactricks: é ê è â" | ||
msgstr "" | ||
|
||
#. type: =head1 | ||
#: iso8859.pod:1 | ||
msgid "ASCII-iso8859-title" | ||
msgstr "" | ||
|
||
#. type: textblock | ||
#: iso8859.pod:5 | ||
msgid "iso8859 string with diactricks: é ê è â" | ||
msgstr "" |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
***************************************************** | ||
* GENERATED FILE, DO NOT EDIT * | ||
* THIS IS NO SOURCE FILE, BUT RESULT OF COMPILATION * | ||
***************************************************** | ||
|
||
This file was generated by po4a(7). Do not store it (in VCS, for example), | ||
but store the PO file used as source file by po4a-translate. | ||
|
||
In fact, consider this as a binary, and the PO file as a regular .c file: | ||
If the PO get lost, keeping this translation up-to-date will be harder. | ||
|
||
=encoding ISO-8859-1 | ||
|
||
=head1 ASCII-ISO8859-TITLE | ||
|
||
COMMON STRING WITH DIACTRICKS: � � � � | ||
|
||
ISO8859 STRING WITH DIACTRICKS: � � � � | ||
|
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[po4a_alias:pod_utf8] pod opt:"--master-charset UTF-8 --localized-charset UTF-8" | ||
[po4a_alias:pod_8859] pod opt:"--master-charset ISO-8859-1 --localized-charset ISO-8859-1" | ||
[po4a_paths] common.pot up:iso8859.up.po | ||
|
||
[type:pod_utf8] utf8.pod up:utf8.up.pod | ||
[type:pod_8859] iso8859.pod up:iso8859.up.pod | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
=head1 ASCII-utf8-title | ||
|
||
common string with diactricks: é ê è â | ||
|
||
utf8 string with diactricks: é ê è â |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
***************************************************** | ||
* GENERATED FILE, DO NOT EDIT * | ||
* THIS IS NO SOURCE FILE, BUT RESULT OF COMPILATION * | ||
***************************************************** | ||
|
||
This file was generated by po4a(7). Do not store it (in VCS, for example), | ||
but store the PO file used as source file by po4a-translate. | ||
|
||
In fact, consider this as a binary, and the PO file as a regular .c file: | ||
If the PO get lost, keeping this translation up-to-date will be harder. | ||
|
||
=encoding UTF-8 | ||
|
||
=head1 ASCII-UTF8-TITLE | ||
|
||
COMMON STRING WITH DIACTRICKS: É Ê È Â | ||
|
||
UTF8 STRING WITH DIACTRICKS: É Ê È Â | ||
|