msgunfmt works properly with escaped hex.

This commit is contained in:
Jim Derry 2016-01-27 11:48:38 +08:00
parent 17e50f2642
commit 53f2a2da2a
18 changed files with 518 additions and 867 deletions

View file

@ -137,7 +137,7 @@ set ( CFILES
${SRCDIR}/buffio.c ${SRCDIR}/fileio.c ${SRCDIR}/streamio.c ${SRCDIR}/buffio.c ${SRCDIR}/fileio.c ${SRCDIR}/streamio.c
${SRCDIR}/tagask.c ${SRCDIR}/tmbstr.c ${SRCDIR}/utf8.c ${SRCDIR}/tagask.c ${SRCDIR}/tmbstr.c ${SRCDIR}/utf8.c
${SRCDIR}/tidylib.c ${SRCDIR}/mappedio.c ${SRCDIR}/gdoc.c ${SRCDIR}/tidylib.c ${SRCDIR}/mappedio.c ${SRCDIR}/gdoc.c
${SRCDIR}/language.c ${SRCDIR}/win_vsnprintf.c ) ${SRCDIR}/language.c )
set ( HFILES set ( HFILES
${INCDIR}/tidyplatform.h ${INCDIR}/tidy.h ${INCDIR}/tidyenum.h ${INCDIR}/tidyplatform.h ${INCDIR}/tidy.h ${INCDIR}/tidyenum.h
${INCDIR}/tidybuffio.h ) ${INCDIR}/tidybuffio.h )

View file

@ -1,51 +0,0 @@
Building with MinGW
===================
Currently building with MinGW on Windows is a bit complicated, and these
assumptions are made:
1. Using MinGW as distributed from [http://mingw.org](http://mingw.org).
2. Using default install path (C:\MinGW)
Pre-Build Instructions
----------------------
**Copy the file `specs` into `C:\MinGW\lib\gcc\<version>\specs`**
This file was generated with `gcc-dumpspecs > specs`, and then modified to add
`-lmsvcrt_tidy` to the `*libgcc:` linking section.
**Copy the file `libmsvcrt_tidy.a` into `C:\MinGW\lib\`** (or someplace else you
know is included in gcc's library search path).
This file is the import library for `msvcrt.dll` that includes the missing
definitions not included in MinGW's own import library. It was generated via
`dlltool -v -d msvcrt.def -l libmsvcrt_tidy.a --dllname %windir%\System32\msvcrt.dll`.
The `msvcrt.def` file is available in the `mingw` directory, too.
You can inspect MS' `msvcrt.dll` with `dumpbin /exports C:\Windows\System32\msvcrt.dll`
in the Visual Studio Command Prompt (not CMD).
Build
-----
`cmake ..\.. -G "MinGW Makefiles"`
`mingw32-make`
Todo
----
Obviously this isn't a fun solution. Some help configuring CMake to include the
import library would be appreciated.
Also I'm not certain we should be distributing the import library as part of the
source. Would it be better to distribute the `msvcrt.def` as part of the source
and build the import library with `dlltool` as part of the build process?

Binary file not shown.

View file

@ -1,4 +0,0 @@
LIBRARY msvcrt.dll
EXPORTS
_vscprintf_p_l
_vsprintf_p

View file

@ -1,147 +0,0 @@
*asm:
*asm_debug:
%{!g0:%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}} %{fdebug-prefix-map=*:--debug-prefix-map %*}
*asm_final:
%{gsplit-dwarf:
objcopy --extract-dwo %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} %{c:%{o*:%:replace-extension(%{o*:%*} .dwo)}%{!o*:%b.dwo}}%{!c:%b.dwo}
objcopy --strip-dwo %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} }
*asm_options:
%{-target-help:%:print-asm-header()} %{v} %{w:-W} %{I*} %a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}
*invoke_as:
%{!fwpa: %{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()} %{!S:-o %|.s |
as %(asm_options) %m.s %A } }
*cpp:
%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} %{pthread:-D_REENTRANT} %{!no-pthread: }
*cpp_options:
%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w} %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*} %{undef} %{save-temps*:-fpch-preprocess}
*cpp_debug_options:
%{d*}
*cpp_unique_options:
%{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*&F*} %{P} %I %{MD:-MD %{!o:%b.d}%{o*:%.d%*}} %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}} %{remap} %{g3|ggdb3|gstabs3|gcoff3|gxcoff3|gvms3:-dD} %{!iplugindir*:%{fplugin*:%:find-plugindir()}} %{H} %C %{D*&U*&A*} %{i*} %Z %i %{fmudflap:-D_MUDFLAP -include mf-runtime.h} %{fmudflapth:-D_MUDFLAP -D_MUDFLAPTH -include mf-runtime.h} %{E|M|MM:%W{o*}}
*trad_capable_cpp:
cc1 -E %{traditional|traditional-cpp:-traditional-cpp}
*cc1:
%(cc1_cpu)
*cc1_options:
%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %{!iplugindir*:%{fplugin*:%:find-plugindir()}} %1 %{!Q:-quiet} %{!dumpbase:-dumpbase %B} %{d*} %{m*} %{aux-info*} %{fcompare-debug-second:%:compare-debug-auxbase-opt(%b)} %{!fcompare-debug-second:%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}}%{!c:%{!S:-auxbase %b}} %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs} %{v:-version} %{pg:-p} %{p} %{f*} %{undef} %{Qn:-fno-ident} %{Qy:} %{-help:--help} %{-target-help:--target-help} %{-version:--version} %{-help=*:--help=%*} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}} %{fsyntax-only:-o %j} %{-param*} %{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants} %{coverage:-fprofile-arcs -ftest-coverage}
*cc1plus:
*link_gcc_c_sequence:
%G %L %G
*link_ssp:
%{fstack-protector|fstack-protector-all:-lssp_nonshared -lssp}
*endfile:
%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} crtend.o%s
*link:
%{mwindows:--subsystem windows} %{mconsole:--subsystem console} %{shared: %{mdll: %eshared and mdll are not compatible}} %{shared: --shared} %{mdll:--dll} %{static:-Bstatic} %{!static:-Bdynamic} %{shared|mdll: -e _DllMainCRTStartup@12 --enable-auto-image-base} %(shared_libgcc_undefs)
*lib:
%{pg:-lgmon} %{pthread:-lpthread} %{!no-pthread: } %{mwindows:-lgdi32 -lcomdlg32} -ladvapi32 -lshell32 -luser32 -lkernel32
*mfwrap:
%{static: %{fmudflap|fmudflapth: --wrap=malloc --wrap=free --wrap=calloc --wrap=realloc --wrap=mmap --wrap=mmap64 --wrap=munmap --wrap=alloca} %{fmudflapth: --wrap=pthread_create}} %{fmudflap|fmudflapth: --wrap=main}
*mflib:
%{fmudflap|fmudflapth: -export-dynamic}
*link_gomp:
*libgcc:
%{mthreads:-lmingwthrd} -lmingw32 %{static|static-libgcc:-lgcc -lgcc_eh} %{!static: %{!static-libgcc: %{!shared: %{!shared-libgcc:-lgcc -lgcc_eh} %{shared-libgcc:-lgcc_s -lgcc} } %{shared:-lgcc_s -lgcc} } } -lmoldname -lmingwex -lmsvcrt -lmsvcrt_tidy
*startfile:
%{shared|mdll:dllcrt2%O%s} %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s} crtbegin.o%s
*cross_compile:
0
*version:
4.8.1
*multilib:
. ;
*multilib_defaults:
*multilib_extra:
*multilib_matches:
*multilib_exclusions:
*multilib_options:
*multilib_reuse:
*linker:
collect2
*linker_plugin_file:
*lto_wrapper:
*lto_gcc:
*link_libgcc:
%D
*md_exec_prefix:
*md_startfile_prefix:
*md_startfile_prefix_1:
*startfile_prefix_spec:
*sysroot_spec:
--sysroot=%R
*sysroot_suffix_spec:
*sysroot_hdrs_suffix_spec:
*self_spec:
*cc1_cpu:
%{march=native:%>march=native %:local_cpu_detect(arch) %{!mtune=*:%>mtune=native %:local_cpu_detect(tune)}} %{mtune=native:%>mtune=native %:local_cpu_detect(tune)}
*shared_libgcc_undefs:
%{shared-libgcc: -u ___register_frame_info -u ___deregister_frame_info}
*link_command:
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %{!fno-use-linker-plugin:%{flto|flto=*|fuse-linker-plugin: -plugin %(linker_plugin_file) -plugin-opt=%(lto_wrapper) -plugin-opt=-fresolution=%u.res %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} }}%{flto|flto=*:%<fcompare-debug*} %{flto} %{flto=*} %l %{pie:-pie} %{fuse-ld=*:-fuse-ld=%*} %X %{o*} %{e*} %{N} %{n} %{r} %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} %{static:} %{L*} %(mfwrap) %(link_libgcc) %{!nostdlib:%{!nodefaultlibs:%{fsanitize=address:} %{fsanitize=thread:}}} %o %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)} %{fgnu-tm:%:include(libitm.spec)%(link_itm)} %(mflib) %{fsplit-stack: --wrap=pthread_create} %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} %{!nostdlib:%{!nodefaultlibs:%{fsanitize=address:%{static-libasan:-Bstatic} -lasan %{static-libasan:-Bdynamic} %{static:%ecannot specify -static with -fsanitize=address} %{fsanitize=thread:%e-fsanitize=address is incompatible with -fsanitize=thread}} %{fsanitize=thread:%{static-libtsan:-Bstatic} -ltsan %{static-libtsan:-Bdynamic} %{!pie:%{!shared:%e-fsanitize=thread linking must be done with -pie or -shared}}}}} %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}} %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}

View file

@ -13,11 +13,9 @@
#include "locale.h" #include "locale.h"
#if defined(_WIN32) #if defined(_WIN32)
#include <windows.h> /* Force console to UTF8. */ #include <windows.h> /* Force console to UTF8. */
/* Windows requires special help for printf positional format specifiers. */ //#define nest_(x) TY_(x)
#include "win_vsnprintf.h" //#define printf nest_(win_printf)
#define nest_(x) TY_(x) //#define fprint nest_(win_fprintf)
#define printf nest_(win_printf)
#define fprint nest_(win_fprintf)
#endif #endif
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG) && defined(_MSC_VER)
#include "sprtf.h" #include "sprtf.h"

View file

@ -450,7 +450,7 @@ extern "C" {
#define utimbuf _utimbuf /* Windows seems to want utimbuf */ #define utimbuf _utimbuf /* Windows seems to want utimbuf */
#define stat _stat #define stat _stat
#define utime _utime #define utime _utime
#define vsnprintf prvTidywin_vsnprintf #define vsnprintf _vsnprintf
#endif /* _WIN32 */ #endif /* _WIN32 */
#endif /* PRESERVE_FILE_TIMES */ #endif /* PRESERVE_FILE_TIMES */

View file

@ -365,8 +365,12 @@ module PoConvertModule
self.items[l_key][num_case][:comment] = comment self.items[l_key][num_case][:comment] = comment
self.items[l_key][num_case][:case] = num_case self.items[l_key][num_case][:case] = num_case
self.items[l_key][num_case][:if_group] = nil self.items[l_key][num_case][:if_group] = nil
tmp = '' # Reconstitute Hex Escapes
string.each_line { |line| tmp << line.lstrip } tmp = string.each_line.collect do |line|
line.lstrip.gsub(/\\x(..)/) { |g| [$1.hex].pack('c*').force_encoding('UTF-8') }
end
# Eliminate C double-double-quotes.
tmp = tmp.join.gsub(/""/) { |g| }
self.items[l_key][num_case][:string] = tmp self.items[l_key][num_case][:string] = tmp
end end
if !self.items || self.items.empty? if !self.items || self.items.empty?
@ -403,6 +407,7 @@ module PoConvertModule
include PoConvertModule include PoConvertModule
attr_accessor :emacs_footer attr_accessor :emacs_footer
attr_accessor :plaintext
######################################################### #########################################################
# initialize # initialize
@ -411,6 +416,7 @@ module PoConvertModule
@po_locale = nil # The locale to use to generate PO files. @po_locale = nil # The locale to use to generate PO files.
@known_locales = {} # The locales we know about. @known_locales = {} # The locales we know about.
@emacs_footer = false # Indicates whether or not to add emacs instructions. @emacs_footer = false # Indicates whether or not to add emacs instructions.
@plaintext = false # Indicates whether or not we should stick to plaintext.
end end
@ -777,18 +783,23 @@ msgstr ""
end end
end end
# Gather some information to format this nicely.
# Gather some information to format this nicely, and perform
# UTF escaping if necessary.
longest_key = 22 # length of TIDY_MESSAGE_TYPE_LAST. longest_key = 22 # length of TIDY_MESSAGE_TYPE_LAST.
longest_value = 10 # reasonable default in case no single-line strings are found. longest_value = 10 # reasonable default in case no single-line strings are found.
po_content.items.each do |key, value| po_content.items.each do |key, value|
longest_key = key.length if key.length > longest_key longest_key = key.length if key.length > longest_key
value.each_value do |value_inner| value.each_value do |value_inner|
value_inner[:string].gsub!(/[^\u0000-\u007e][0-9a-fA-F]?/) do |c| # If we're not plaintext then escape UTF sequences.
esc = c[0].bytes.map{ |b| '\\x' + b.to_s(16) }.join('') unless plaintext
if c[1] value_inner[:string].gsub!(/[^\u0000-\u007e][0-9a-fA-F]?/) do |c|
esc += '""' + c[1] esc = c[0].bytes.map{ |b| '\\x' + b.to_s(16) }.join('')
if c[1]
esc += '""' + c[1]
end
esc
end end
esc
end end
length = value_inner[:string].length length = value_inner[:string].length
longest_value = length if length > longest_value && !value_inner[:string].start_with?("\n") longest_value = length if length > longest_value && !value_inner[:string].start_with?("\n")
@ -875,7 +886,7 @@ msgstr ""
File.rename(output_file, safe_backup_name(output_file)) File.rename(output_file, safe_backup_name(output_file))
end end
File.open(output_file, 'w') do |f| File.open(output_file, 'w') do |f|
#f.write "\uFEFF" # MSVC requires a BOM. f.write "\uFEFF" if plaintext # MSVC requires a BOM.
f.write(report) f.write(report)
end end
@@log.info "#{__method__}: Results written to #{output_file}" @@log.info "#{__method__}: Results written to #{output_file}"
@ -1026,10 +1037,12 @@ Complete Help:
desc 'msgunfmt <input_file.h>', 'Converts an existing Tidy header H file to PO format.' desc 'msgunfmt <input_file.h>', 'Converts an existing Tidy header H file to PO format.'
long_desc <<-LONG_DESC long_desc <<-LONG_DESC
Converts an existing Tidy header H file to a PO file using the locale Converts an existing Tidy header H file to a PO file using the locale
specified in the H file. Specifying <input_file.h> is required. The specified in the H file. Specifying <input_file.h> is required, and
resulting file will consist of English original strings, the translated multiple input files may be specified.
strings from the header, and blank translated strings if not specified in
the header. The resulting file will consist of English original strings, the
translated strings from the header, and blank translated strings if not
specified in the header.
You can use the --baselang option to gather the untranslated strings from You can use the --baselang option to gather the untranslated strings from
a different header file. This may be useful for translators that want to a different header file. This may be useful for translators that want to
@ -1039,14 +1052,20 @@ Complete Help:
Use case: create a PO file from an existing Tidy header H file using a Use case: create a PO file from an existing Tidy header H file using a
combination of languages that are suitable to you. combination of languages that are suitable to you.
LONG_DESC LONG_DESC
def msgunfmt(input_file = nil) def msgunfmt(*args)
converter = PoConverter.new error_count = 0
converter.emacs_footer = options[:emacs]
set_options args.each do |input_file|
if converter.convert_to_po( input_file, options[:baselang] ) converter = PoConverter.new
converter.emacs_footer = options[:emacs]
set_options
error_count = converter.convert_to_po(input_file, options[:baselang]) ? error_count : error_count + 1
end
if error_count == 0
puts 'msgunfmt exited without errors.' puts 'msgunfmt exited without errors.'
else else
puts 'msgunfmt exited with errors. Consider using the --verbose or --debug options.' puts "msgunfmt exited with errors #{error_count} time(s). Consider using the --verbose or --debug options."
exit 1 exit 1
end end
end # msgunfmt end # msgunfmt
@ -1060,10 +1079,14 @@ Complete Help:
:type => :string, :type => :string,
:desc => 'Specifies a base language <file.h> from which to exclude translated strings.', :desc => 'Specifies a base language <file.h> from which to exclude translated strings.',
:aliases => '-b' :aliases => '-b'
option :plaintext,
:type => :boolean,
:desc => 'Specifies that the generated file contain plain text instead of hex escaped characters.',
:aliases => '-p'
desc 'msgfmt <input_file.po>', 'Creates a Tidy header H file from the given PO file.' desc 'msgfmt <input_file.po>', 'Creates a Tidy header H file from the given PO file.'
long_desc <<-LONG_DESC long_desc <<-LONG_DESC
Creates a Tidy header H file from the specified <input_file.po> PO file, Creates a Tidy header H file from the specified <input_file.po> PO file,
which is a required argument. which is a required argument. Multiple input files may be specified.
You can use the --baselang option to exclude already translated strings from an You can use the --baselang option to exclude already translated strings from an
inherited base language. This will help keep Tidy's library and executable size inherited base language. This will help keep Tidy's library and executable size
@ -1075,13 +1098,20 @@ Complete Help:
Use case: Tidy can only build H files, and so this command will convert Use case: Tidy can only build H files, and so this command will convert
PO files to something useful. PO files to something useful.
LONG_DESC LONG_DESC
def msgfmt(input_file) def msgfmt(*args)
converter = PoConverter.new error_count = 0
set_options
if converter.convert_to_h( input_file, options[:baselang] ) args.each do |input_file|
converter = PoConverter.new
converter.plaintext = options[:plaintext]
set_options
error_count = converter.convert_to_h( input_file, options[:baselang] ) ? error_count : error_count + 1
end
if error_count == 0
puts 'msgfmt exited without errors.' puts 'msgfmt exited without errors.'
else else
puts 'msgfmt exited with errors. Consider using the --verbose or --debug options.' puts "msgfmt exited with errors #{error_count} time(s). Consider using the --verbose or --debug options."
exit 1 exit 1
end end
end # msgfmt end # msgfmt

View file

@ -22,7 +22,7 @@ msgstr ""
#, c-format #, c-format
msgctxt "FILE_CANT_OPEN" msgctxt "FILE_CANT_OPEN"
msgid "Can't open \"%1$s\"\n" msgid "Can't open \"%1$s\"\n"
msgstr "" msgstr "No se puede abrir \"%1$s\"\n"
#, c-format #, c-format
msgctxt "LINE_COLUMN_STRING" msgctxt "LINE_COLUMN_STRING"

View file

@ -18,21 +18,15 @@
#endif #endif
#include "tmbstr.h" #include "tmbstr.h"
#include "locale.h" #include "locale.h"
#if defined(_WIN32)
#include "win_vsnprintf.h"
#define nest_(x) TY_(x)
#define printf nest_(win_printf)
#define fprint nest_(win_fprintf)
#endif
/** /**
* This structure type provides universal access to all of Tidy's strings. * This structure type provides universal access to all of Tidy's strings.
*/ */
typedef struct { typedef struct {
languageDefinition *currentLanguage; languageDefinition *currentLanguage;
languageDefinition *fallbackLanguage; languageDefinition *fallbackLanguage;
languageDefinition *languages[]; languageDefinition *languages[];
} tidyLanguagesType; } tidyLanguagesType;
@ -41,20 +35,20 @@ typedef struct {
* `.currentLanguage` to language_en, which is Tidy's default language. * `.currentLanguage` to language_en, which is Tidy's default language.
*/ */
static tidyLanguagesType tidyLanguages = { static tidyLanguagesType tidyLanguages = {
&language_en, /* current language */ &language_en, /* current language */
&language_en, /* first fallback language */ &language_en, /* first fallback language */
{ {
/* Required localization! */ /* Required localization! */
&language_en, &language_en,
#if SUPPORT_LOCALIZATIONS #if SUPPORT_LOCALIZATIONS
/* These additional languages are installed. */ /* These additional languages are installed. */
&language_en_gb, &language_en_gb,
&language_es, &language_es,
&language_es_mx, &language_es_mx,
&language_zh_cn, &language_zh_cn,
#endif #endif
NULL /* This array MUST be null terminated. */ NULL /* This array MUST be null terminated. */
} }
}; };
@ -64,168 +58,168 @@ static tidyLanguagesType tidyLanguages = {
* POSIX names). * POSIX names).
*/ */
static const tidyLocaleMapItem localeMappings[] = { static const tidyLocaleMapItem localeMappings[] = {
{ "america", "en_us" }, { "america", "en_us" },
{ "american english", "en_us" }, { "american english", "en_us" },
{ "american-english", "en_us" }, { "american-english", "en_us" },
{ "american", "en_us" }, { "american", "en_us" },
{ "aus", "en_au" }, { "aus", "en_au" },
{ "australia", "en_au" }, { "australia", "en_au" },
{ "australian", "en_au" }, { "australian", "en_au" },
{ "austria", "de_at" }, { "austria", "de_at" },
{ "aut", "de_at" }, { "aut", "de_at" },
{ "bel", "nl_be" }, { "bel", "nl_be" },
{ "belgian", "nl_be" }, { "belgian", "nl_be" },
{ "belgium", "nl_be" }, { "belgium", "nl_be" },
{ "bra", "pt-br" }, { "bra", "pt-br" },
{ "brazil", "pt-br" }, { "brazil", "pt-br" },
{ "britain", "en_gb" }, { "britain", "en_gb" },
{ "can", "en_ca" }, { "can", "en_ca" },
{ "canada", "en_ca" }, { "canada", "en_ca" },
{ "canadian", "en_ca" }, { "canadian", "en_ca" },
{ "che", "de_ch" }, { "che", "de_ch" },
{ "china", "zh_cn" }, { "china", "zh_cn" },
{ "chinese-simplified", "zh" }, { "chinese-simplified", "zh" },
{ "chinese-traditional", "zh_tw" }, { "chinese-traditional", "zh_tw" },
{ "chinese", "zh" }, { "chinese", "zh" },
{ "chn", "zh_cn" }, { "chn", "zh_cn" },
{ "chs", "zh" }, { "chs", "zh" },
{ "cht", "zh_tw" }, { "cht", "zh_tw" },
{ "csy", "cs" }, { "csy", "cs" },
{ "cze", "cs_cz" }, { "cze", "cs_cz" },
{ "czech", "cs_cz" }, { "czech", "cs_cz" },
{ "dan", "da" }, { "dan", "da" },
{ "danish", "da" }, { "danish", "da" },
{ "dea", "de_at" }, { "dea", "de_at" },
{ "denmark", "da_dk" }, { "denmark", "da_dk" },
{ "des", "de_ch" }, { "des", "de_ch" },
{ "deu", "de" }, { "deu", "de" },
{ "dnk", "da_dk" }, { "dnk", "da_dk" },
{ "dutch-belgian", "nl_be" }, { "dutch-belgian", "nl_be" },
{ "dutch", "nl" }, { "dutch", "nl" },
{ "ell", "el" }, { "ell", "el" },
{ "ena", "en_au" }, { "ena", "en_au" },
{ "enc", "en_ca" }, { "enc", "en_ca" },
{ "eng", "eb_gb" }, { "eng", "eb_gb" },
{ "england", "en_gb" }, { "england", "en_gb" },
{ "english-american", "en_us" }, { "english-american", "en_us" },
{ "english-aus", "en_au" }, { "english-aus", "en_au" },
{ "english-can", "en_ca" }, { "english-can", "en_ca" },
{ "english-nz", "en_nz" }, { "english-nz", "en_nz" },
{ "english-uk", "eb_gb" }, { "english-uk", "eb_gb" },
{ "english-us", "en_us" }, { "english-us", "en_us" },
{ "english-usa", "en_us" }, { "english-usa", "en_us" },
{ "english", "en" }, { "english", "en" },
{ "enu", "en_us" }, { "enu", "en_us" },
{ "enz", "en_nz" }, { "enz", "en_nz" },
{ "esm", "es-mx" }, { "esm", "es-mx" },
{ "esn", "es" }, { "esn", "es" },
{ "esp", "es" }, { "esp", "es" },
{ "fin", "fi" }, { "fin", "fi" },
{ "finland", "fi_fi" }, { "finland", "fi_fi" },
{ "finnish", "fi" }, { "finnish", "fi" },
{ "fra", "fr" }, { "fra", "fr" },
{ "france", "fr_fr" }, { "france", "fr_fr" },
{ "frb", "fr_be" }, { "frb", "fr_be" },
{ "frc", "fr_ca" }, { "frc", "fr_ca" },
{ "french-belgian", "fr_be" }, { "french-belgian", "fr_be" },
{ "french-canadian", "fr_ca" }, { "french-canadian", "fr_ca" },
{ "french-swiss", "fr_ch" }, { "french-swiss", "fr_ch" },
{ "french", "fr" }, { "french", "fr" },
{ "frs", "fr_ch" }, { "frs", "fr_ch" },
{ "gbr", "en_gb" }, { "gbr", "en_gb" },
{ "german-austrian", "de_at" }, { "german-austrian", "de_at" },
{ "german-swiss", "de_ch" }, { "german-swiss", "de_ch" },
{ "german", "de" }, { "german", "de" },
{ "germany", "de_de" }, { "germany", "de_de" },
{ "grc", "el_gr" }, { "grc", "el_gr" },
{ "great britain", "en_gb" }, { "great britain", "en_gb" },
{ "greece", "el_gr" }, { "greece", "el_gr" },
{ "greek", "el" }, { "greek", "el" },
{ "hkg", "zh_hk" }, { "hkg", "zh_hk" },
{ "holland", "nl_nl" }, { "holland", "nl_nl" },
{ "hong kong", "zh_hk" }, { "hong kong", "zh_hk" },
{ "hong-kong", "zh_hk" }, { "hong-kong", "zh_hk" },
{ "hun", "hu" }, { "hun", "hu" },
{ "hungarian", "hu" }, { "hungarian", "hu" },
{ "hungary", "hu_hu" }, { "hungary", "hu_hu" },
{ "iceland", "is_is" }, { "iceland", "is_is" },
{ "icelandic", "is" }, { "icelandic", "is" },
{ "ireland", "en_ie" }, { "ireland", "en_ie" },
{ "irl", "en_ie" }, { "irl", "en_ie" },
{ "isl", "is" }, { "isl", "is" },
{ "ita", "it" }, { "ita", "it" },
{ "ita", "it_it" }, { "ita", "it_it" },
{ "italian-swiss", "it_ch" }, { "italian-swiss", "it_ch" },
{ "italian", "it" }, { "italian", "it" },
{ "italy", "it_it" }, { "italy", "it_it" },
{ "its", "it_ch" }, { "its", "it_ch" },
{ "japan", "ja_jp" }, { "japan", "ja_jp" },
{ "japanese", "ja" }, { "japanese", "ja" },
{ "jpn", "ja" }, { "jpn", "ja" },
{ "kor", "ko" }, { "kor", "ko" },
{ "korea", "ko_kr" }, { "korea", "ko_kr" },
{ "korean", "ko" }, { "korean", "ko" },
{ "mex", "es-mx" }, { "mex", "es-mx" },
{ "mexico", "es-mx" }, { "mexico", "es-mx" },
{ "netherlands", "nl_nl" }, { "netherlands", "nl_nl" },
{ "new zealand", "en_nz" }, { "new zealand", "en_nz" },
{ "new-zealand", "en_nz" }, { "new-zealand", "en_nz" },
{ "nlb", "nl_be" }, { "nlb", "nl_be" },
{ "nld", "nl" }, { "nld", "nl" },
{ "non", "nn" }, { "non", "nn" },
{ "nor", "nb" }, { "nor", "nb" },
{ "norway", "no" }, { "norway", "no" },
{ "norwegian-bokmal", "nb" }, { "norwegian-bokmal", "nb" },
{ "norwegian-nynorsk", "nn" }, { "norwegian-nynorsk", "nn" },
{ "norwegian", "no" }, { "norwegian", "no" },
{ "nz", "en_nz" }, { "nz", "en_nz" },
{ "nzl", "en_nz" }, { "nzl", "en_nz" },
{ "plk", "pl" }, { "plk", "pl" },
{ "pol", "pl-pl" }, { "pol", "pl-pl" },
{ "poland", "pl-pl" }, { "poland", "pl-pl" },
{ "polish", "pl" }, { "polish", "pl" },
{ "portugal", "pt-pt" }, { "portugal", "pt-pt" },
{ "portuguese-brazil", "pt-br" }, { "portuguese-brazil", "pt-br" },
{ "portuguese", "pt" }, { "portuguese", "pt" },
{ "pr china", "zh_cn" }, { "pr china", "zh_cn" },
{ "pr-china", "zh_cn" }, { "pr-china", "zh_cn" },
{ "prt", "pt-pt" }, { "prt", "pt-pt" },
{ "ptb", "pt-br" }, { "ptb", "pt-br" },
{ "ptg", "pt" }, { "ptg", "pt" },
{ "rus", "ru" }, { "rus", "ru" },
{ "russia", "ru-ru" }, { "russia", "ru-ru" },
{ "russian", "ru" }, { "russian", "ru" },
{ "sgp", "zh_sg" }, { "sgp", "zh_sg" },
{ "singapore", "zh_sg" }, { "singapore", "zh_sg" },
{ "sky", "sk" }, { "sky", "sk" },
{ "slovak", "sk" }, { "slovak", "sk" },
{ "spain", "es-es" }, { "spain", "es-es" },
{ "spanish-mexican", "es-mx" }, { "spanish-mexican", "es-mx" },
{ "spanish-modern", "es" }, { "spanish-modern", "es" },
{ "spanish", "es" }, { "spanish", "es" },
{ "sve", "sv" }, { "sve", "sv" },
{ "svk", "sk-sk" }, { "svk", "sk-sk" },
{ "swe", "sv-se" }, { "swe", "sv-se" },
{ "sweden", "sv-se" }, { "sweden", "sv-se" },
{ "swedish", "sv" }, { "swedish", "sv" },
{ "swiss", "de_ch" }, { "swiss", "de_ch" },
{ "switzerland", "de_ch" }, { "switzerland", "de_ch" },
{ "taiwan", "zh_tw" }, { "taiwan", "zh_tw" },
{ "trk", "tr" }, { "trk", "tr" },
{ "tur", "tr-tr" }, { "tur", "tr-tr" },
{ "turkey", "tr-tr" }, { "turkey", "tr-tr" },
{ "turkish", "tr" }, { "turkish", "tr" },
{ "twn", "zh_tw" }, { "twn", "zh_tw" },
{ "uk", "en_gb" }, { "uk", "en_gb" },
{ "united kingdom", "en_gb" }, { "united kingdom", "en_gb" },
{ "united states", "en_us" }, { "united states", "en_us" },
{ "united-kingdom", "en_gb" }, { "united-kingdom", "en_gb" },
{ "united-states", "en_us" }, { "united-states", "en_us" },
{ "us", "en_us" }, { "us", "en_us" },
{ "usa", "en_us" }, { "usa", "en_us" },
/* MUST be last. */ /* MUST be last. */
{ NULL, NULL } { NULL, NULL }
}; };
@ -499,18 +493,18 @@ ctmbstr tidyErrorCodeAsString(uint code)
*/ */
ctmbstr TY_(tidyLocalizedString)( uint messageType, languageDefinition *definition, uint plural ) ctmbstr TY_(tidyLocalizedString)( uint messageType, languageDefinition *definition, uint plural )
{ {
int i; int i;
languageDictionary *dictionary = &definition->messages; languageDictionary *dictionary = &definition->messages;
uint pluralForm = definition->whichPluralForm(plural); uint pluralForm = definition->whichPluralForm(plural);
for (i = 0; (*dictionary)[i].value; ++i) for (i = 0; (*dictionary)[i].value; ++i)
{ {
if ( (*dictionary)[i].key == messageType && (*dictionary)[i].pluralForm == pluralForm ) if ( (*dictionary)[i].key == messageType && (*dictionary)[i].pluralForm == pluralForm )
{ {
return (*dictionary)[i].value; return (*dictionary)[i].value;
} }
} }
return NULL; return NULL;
} }
@ -525,28 +519,28 @@ ctmbstr TY_(tidyLocalizedString)( uint messageType, languageDefinition *definiti
*/ */
ctmbstr tidyLocalizedStringN( uint messageType, uint quantity ) ctmbstr tidyLocalizedStringN( uint messageType, uint quantity )
{ {
ctmbstr result; ctmbstr result;
result = TY_(tidyLocalizedString)( messageType, tidyLanguages.currentLanguage, quantity); result = TY_(tidyLocalizedString)( messageType, tidyLanguages.currentLanguage, quantity);
if (!result && tidyLanguages.fallbackLanguage ) if (!result && tidyLanguages.fallbackLanguage )
{ {
result = TY_(tidyLocalizedString)( messageType, tidyLanguages.fallbackLanguage, quantity); result = TY_(tidyLocalizedString)( messageType, tidyLanguages.fallbackLanguage, quantity);
} }
if (!result) if (!result)
{ {
/* Fallback to en which is built in. */ /* Fallback to en which is built in. */
result = TY_(tidyLocalizedString)( messageType, &language_en, quantity); result = TY_(tidyLocalizedString)( messageType, &language_en, quantity);
} }
if (!result) if (!result)
{ {
/* Last resort: Fallback to en singular which is built in. */ /* Last resort: Fallback to en singular which is built in. */
result = TY_(tidyLocalizedString)( messageType, &language_en, 1); result = TY_(tidyLocalizedString)( messageType, &language_en, 1);
} }
return result; return result;
} }
@ -560,7 +554,7 @@ ctmbstr tidyLocalizedStringN( uint messageType, uint quantity )
*/ */
ctmbstr tidyLocalizedString( uint messageType ) ctmbstr tidyLocalizedString( uint messageType )
{ {
return tidyLocalizedStringN( messageType, 1 ); return tidyLocalizedStringN( messageType, 1 );
} }
@ -574,23 +568,23 @@ ctmbstr tidyLocalizedString( uint messageType )
*/ */
tmbstr tidySystemLocale(tmbstr result) tmbstr tidySystemLocale(tmbstr result)
{ {
ctmbstr temp; ctmbstr temp;
/* This should set the OS locale. */ /* This should set the OS locale. */
setlocale( LC_ALL, "" ); setlocale( LC_ALL, "" );
/* This should read the current locale. */ /* This should read the current locale. */
temp = setlocale( LC_ALL, NULL); temp = setlocale( LC_ALL, NULL);
/* Make a new copy of the string, because temp /* Make a new copy of the string, because temp
always points to the current locale. */ always points to the current locale. */
if (( result = malloc( strlen( temp ) + 1 ) )) if (( result = malloc( strlen( temp ) + 1 ) ))
strcpy(result, temp); strcpy(result, temp);
/* This should restore the C locale. */ /* This should restore the C locale. */
setlocale( LC_ALL, "C" ); setlocale( LC_ALL, "C" );
return result; return result;
} }
@ -601,47 +595,52 @@ tmbstr tidySystemLocale(tmbstr result)
*/ */
tmbstr tidyNormalizedLocaleName( ctmbstr locale ) tmbstr tidyNormalizedLocaleName( ctmbstr locale )
{ {
uint i; uint i;
uint len; uint len;
static char result[6] = "xx_yy"; static char result[6] = "xx_yy";
tmbstr search = strdup(locale); char character[1];
search = TY_(tmbstrtolower)(search); tmbstr search = strdup(locale);
search = TY_(tmbstrtolower)(search);
/* See if our string matches a Windows name. */
for (i = 0; localeMappings[i].winName; ++i) /* See if our string matches a Windows name. */
{ for (i = 0; localeMappings[i].winName; ++i)
if ( strcmp( localeMappings[i].winName, search ) == 0 ) {
{ if ( strcmp( localeMappings[i].winName, search ) == 0 )
{
free(search); free(search);
search = strdup(localeMappings[i].POSIXName); search = strdup(localeMappings[i].POSIXName);
break; break;
} }
} }
/* We're going to be stupid about this and trust the user, and /* We're going to be stupid about this and trust the user, and
return just the first two characters if they exist and the return just the first two characters if they exist and the
4th and 5th if they exist. The worst that can happen is a 4th and 5th if they exist. The worst that can happen is a
junk language that doesn't exist and won't be set. */ junk language that doesn't exist and won't be set. */
len = strlen( search ); len = strlen( search );
len = len <= 5 ? len : 5; len = len <= 5 ? len : 5;
for ( i = 0; i < len; i++ ) for ( i = 0; i < len; i++ )
{ {
if ( i == 2 ) if ( i == 2 )
{ {
/* Either terminate the string or ensure there's an underscore */ /* Either terminate the string or ensure there's an underscore */
strncpy( result + i, strlen( search ) >= 5 ? "_" : '\0', 1 ); if (strlen( search) >= 5)
} character[0] = '_';
else else
{ character[0] = '\0';
strncpy( result + i, search + i, 1); strncpy( result + i, character, 1 );
result[i] = tolower( result[i] ); }
} else
} {
strncpy( result + i, search + i, 1);
result[i] = tolower( result[i] );
}
}
if ( search ) free( search ); if ( search ) free( search );
return result; return result;
} }
@ -651,22 +650,22 @@ tmbstr tidyNormalizedLocaleName( ctmbstr locale )
*/ */
languageDefinition *TY_(tidyTestLanguage)( ctmbstr languageCode ) languageDefinition *TY_(tidyTestLanguage)( ctmbstr languageCode )
{ {
uint i; uint i;
languageDefinition *testLang; languageDefinition *testLang;
languageDictionary *testDict; languageDictionary *testDict;
ctmbstr testCode; ctmbstr testCode;
for (i = 0; tidyLanguages.languages[i]; ++i) for (i = 0; tidyLanguages.languages[i]; ++i)
{ {
testLang = tidyLanguages.languages[i]; testLang = tidyLanguages.languages[i];
testDict = &testLang->messages; testDict = &testLang->messages;
testCode = (*testDict)[0].value; testCode = (*testDict)[0].value;
if ( strcmp(testCode, languageCode) == 0 ) if ( strcmp(testCode, languageCode) == 0 )
return testLang; return testLang;
} }
return NULL; return NULL;
} }
@ -683,30 +682,30 @@ languageDefinition *TY_(tidyTestLanguage)( ctmbstr languageCode )
*/ */
Bool tidySetLanguage( ctmbstr languageCode ) Bool tidySetLanguage( ctmbstr languageCode )
{ {
languageDefinition *dict1 = NULL; languageDefinition *dict1 = NULL;
languageDefinition *dict2 = NULL; languageDefinition *dict2 = NULL;
tmbstr wantCode = NULL; tmbstr wantCode = NULL;
char lang[3] = ""; char lang[3] = "";
if ( !languageCode || !(wantCode = tidyNormalizedLocaleName( languageCode )) ) if ( !languageCode || !(wantCode = tidyNormalizedLocaleName( languageCode )) )
{ {
return no; return no;
} }
/* We want to use the specified language as the currentLanguage, and set /* We want to use the specified language as the currentLanguage, and set
fallback language as necessary. We have either a two or five digit code, fallback language as necessary. We have either a two or five digit code,
either or both of which might be installed. Let's test both of them: either or both of which might be installed. Let's test both of them:
*/ */
dict1 = TY_(tidyTestLanguage( wantCode )); /* WANTED language */ dict1 = TY_(tidyTestLanguage( wantCode )); /* WANTED language */
if ( strlen( wantCode ) > 2 ) if ( strlen( wantCode ) > 2 )
{ {
strncpy(lang, wantCode, 2); strncpy(lang, wantCode, 2);
lang[2] = '\0'; lang[2] = '\0';
dict2 = TY_(tidyTestLanguage( lang ) ); /* BACKUP language? */ dict2 = TY_(tidyTestLanguage( lang ) ); /* BACKUP language? */
} }
if ( dict1 && dict2 ) if ( dict1 && dict2 )
{ {
tidyLanguages.currentLanguage = dict1; tidyLanguages.currentLanguage = dict1;
@ -726,8 +725,8 @@ Bool tidySetLanguage( ctmbstr languageCode )
{ {
/* No change. */ /* No change. */
} }
return dict1 || dict2; return dict1 || dict2;
} }
@ -736,9 +735,9 @@ Bool tidySetLanguage( ctmbstr languageCode )
*/ */
ctmbstr tidyGetLanguage() ctmbstr tidyGetLanguage()
{ {
languageDefinition *langDef = tidyLanguages.currentLanguage; languageDefinition *langDef = tidyLanguages.currentLanguage;
languageDictionary *langDict = &langDef->messages; languageDictionary *langDict = &langDef->messages;
return (*langDict)[0].value; return (*langDict)[0].value;
} }
@ -748,7 +747,7 @@ ctmbstr tidyGetLanguage()
*/ */
ctmbstr tidyDefaultString( uint messageType ) ctmbstr tidyDefaultString( uint messageType )
{ {
return TY_(tidyLocalizedString)( messageType, &language_en, 1); return TY_(tidyLocalizedString)( messageType, &language_en, 1);
} }
@ -813,16 +812,16 @@ uint getNextStringKey( TidyIterator* iter )
*/ */
const uint TY_(tidyLanguageListSize)() const uint TY_(tidyLanguageListSize)()
{ {
static uint array_size = 0; static uint array_size = 0;
if ( array_size == 0 ) if ( array_size == 0 )
{ {
while ( localeMappings[array_size].winName ) { while ( localeMappings[array_size].winName ) {
array_size++; array_size++;
} }
} }
return array_size; return array_size;
} }
/** /**
@ -863,16 +862,16 @@ const tidyLocaleMapItem *getNextWindowsLanguage( TidyIterator *iter )
*/ */
const uint TY_(tidyInstalledLanguageListSize)() const uint TY_(tidyInstalledLanguageListSize)()
{ {
static uint array_size = 0; static uint array_size = 0;
if ( array_size == 0 ) if ( array_size == 0 )
{ {
while ( tidyLanguages.languages[array_size] ) { while ( tidyLanguages.languages[array_size] ) {
array_size++; array_size++;
} }
} }
return array_size; return array_size;
} }
/** /**

View file

@ -1,4 +1,4 @@
#ifndef language_en_h #ifndef language_en_h
#define language_en_h #define language_en_h
/* /*
* language_en.h * language_en.h
@ -16,9 +16,6 @@
* See tidy.h and access.h for the copyright notice. * See tidy.h and access.h for the copyright notice.
* *
* Created by Jim Derry on 11/28/15. * Created by Jim Derry on 11/28/15.
*
* PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2016-01-12
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
@ -72,16 +69,16 @@ static languageDefinition language_en = { whichPluralForm_en, {
{/* Only translate if a URL to the target language can be found. */ {/* Only translate if a URL to the target language can be found. */
ATRC_ACCESS_URL, 0, "http://www.html-tidy.org/accessibility/" ATRC_ACCESS_URL, 0, "http://www.html-tidy.org/accessibility/"
}, },
{ FILE_CANT_OPEN, 0, "Can't open \"%1$s\"\n" }, { FILE_CANT_OPEN, 0, "Can't open \"%s\"\n" },
{ LINE_COLUMN_STRING, 0, "line %1$d column %2$d - " }, { LINE_COLUMN_STRING, 0, "line %d column %d - " },
{ STRING_CONTENT_LOOKS, 0, "Document content looks like %1$s" }, { STRING_CONTENT_LOOKS, 0, "Document content looks like %s" },
{/* For example, "discarding invalid UTF-16 surrogate pair" */ {/* For example, "discarding invalid UTF-16 surrogate pair" */
STRING_DISCARDING, 0, "discarding" STRING_DISCARDING, 0, "discarding"
}, },
{ STRING_DOCTYPE_GIVEN, 0, "Doctype given is \"%1$s\"" }, { STRING_DOCTYPE_GIVEN, 0, "Doctype given is \"%s\"" },
{/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ {/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
STRING_ERROR_COUNT, 0, "Tidy found %1$u %2$s and %3$u %4$s!" STRING_ERROR_COUNT, 0, "Tidy found %u %s and %u %s!"
}, },
{ STRING_ERROR_COUNT_ERROR, 0, "error" }, { STRING_ERROR_COUNT_ERROR, 0, "error" },
{ STRING_ERROR_COUNT_ERROR, 1, "errors" }, { STRING_ERROR_COUNT_ERROR, 1, "errors" },
@ -91,7 +88,7 @@ static languageDefinition language_en = { whichPluralForm_en, {
{/* This is not a formal name and can be translated. */ {/* This is not a formal name and can be translated. */
STRING_HTML_PROPRIETARY, 0, "HTML Proprietary" STRING_HTML_PROPRIETARY, 0, "HTML Proprietary"
}, },
{ STRING_MISSING_MALFORMED, 0, "missing or malformed argument for option: %1$s" }, { STRING_MISSING_MALFORMED, 0, "missing or malformed argument for option: %s" },
{ STRING_NO_ERRORS, 0, "No warnings or errors were found." }, { STRING_NO_ERRORS, 0, "No warnings or errors were found." },
{ STRING_NO_SYSID, 0, "No system identifier in emitted doctype" }, { STRING_NO_SYSID, 0, "No system identifier in emitted doctype" },
{ STRING_NOT_ALL_SHOWN, 0, "Not all warnings/errors were shown." }, { STRING_NOT_ALL_SHOWN, 0, "Not all warnings/errors were shown." },
@ -102,9 +99,9 @@ static languageDefinition language_en = { whichPluralForm_en, {
{/* For example, "you should avoid using the specified encoding." */ {/* For example, "you should avoid using the specified encoding." */
STRING_SPECIFIED, 0, "specified" STRING_SPECIFIED, 0, "specified"
}, },
{ STRING_UNKNOWN_FILE, 0, "%1$s: can't open file \"%2$s\"\n" }, { STRING_UNKNOWN_FILE, 0, "%s: can't open file \"%s\"\n" },
{ STRING_UNKNOWN_OPTION, 0, "unknown option: %1$s" }, { STRING_UNKNOWN_OPTION, 0, "unknown option: %s" },
{ STRING_UNRECZD_OPTION, 0, "unrecognized option -%1$c use -help to list options\n" }, { STRING_UNRECZD_OPTION, 0, "unrecognized option -%c use -help to list options\n" },
{ STRING_XML_DECLARATION, 0, "XML declaration" }, { STRING_XML_DECLARATION, 0, "XML declaration" },
{/* This console output should be limited to 78 characters per line. */ {/* This console output should be limited to 78 characters per line. */
@ -133,22 +130,23 @@ static languageDefinition language_en = { whichPluralForm_en, {
"than Windows character code 153 (0x2122 in Unicode). Note that\n" "than Windows character code 153 (0x2122 in Unicode). Note that\n"
"as of February 1998 few browsers support the new entities.\n\n" "as of February 1998 few browsers support the new entities.\n\n"
}, },
{/* This console output should be limited to 78 characters per line. */ {/* This console output should be limited to 78 characters per line.
- %s represents a string-encoding name which may be localized in your language. */
TEXT_VENDOR_CHARS, 0, TEXT_VENDOR_CHARS, 0,
"It is unlikely that vendor-specific, system-dependent encodings\n" "It is unlikely that vendor-specific, system-dependent encodings\n"
"work widely enough on the World Wide Web; you should avoid using the \n" "work widely enough on the World Wide Web; you should avoid using the \n"
"%1$s character encoding, instead you are recommended to\n" "%s character encoding, instead you are recommended to\n"
"use named entities, e.g. &trade;.\n" "use named entities, e.g. &trade;.\n"
"\n" "\n"
}, },
{/* This console output should be limited to 78 characters per line. {/* This console output should be limited to 78 characters per line.
- %1$s represents a string-encoding name which may be localized in your language. - %s represents a string-encoding name which may be localized in your language.
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TEXT_SGML_CHARS, 0, TEXT_SGML_CHARS, 0,
"Character codes 128 to 159 (U+0080 to U+009F) are not allowed in HTML;\n" "Character codes 128 to 159 (U+0080 to U+009F) are not allowed in HTML;\n"
"even if they were, they would likely be unprintable control characters.\n" "even if they were, they would likely be unprintable control characters.\n"
"Tidy assumed you wanted to refer to a character with the same byte value in the \n" "Tidy assumed you wanted to refer to a character with the same byte value in the \n"
"%1$s encoding and replaced that reference with the Unicode \n" "%s encoding and replaced that reference with the Unicode \n"
"equivalent.\n" "equivalent.\n"
"\n" "\n"
}, },
@ -330,100 +328,100 @@ static languageDefinition language_en = { whichPluralForm_en, {
/* ReportEncodingWarning */ /* ReportEncodingWarning */
{ {
ENCODING_MISMATCH, 0, "specified input encoding (%1$s) does not match actual input encoding (%2$s)" }, /* Warning */ ENCODING_MISMATCH, 0, "specified input encoding (%s) does not match actual input encoding (%s)" }, /* Warning */
/* ReportEncodingError */ /* ReportEncodingError */
{ VENDOR_SPECIFIC_CHARS, 0, "%1$s invalid character code %2$s" }, /* Error */ { VENDOR_SPECIFIC_CHARS, 0, "%s invalid character code %s" }, /* Error */
{ INVALID_SGML_CHARS, 0, "%1$s invalid character code %2$s" }, /* Error */ { INVALID_SGML_CHARS, 0, "%s invalid character code %s" }, /* Error */
{ INVALID_UTF8, 0, "%1$s invalid UTF-8 bytes (char. code %2$s)" }, /* Error */ { INVALID_UTF8, 0, "%s invalid UTF-8 bytes (char. code %s)" }, /* Error */
{ INVALID_UTF16, 0, "%1$s invalid UTF-16 surrogate pair (char. code %2$s)" }, /* Error */ { INVALID_UTF16, 0, "%s invalid UTF-16 surrogate pair (char. code %s)" }, /* Error */
{ INVALID_NCR, 0, "%1$s invalid numeric character reference %2$s" }, /* Error */ { INVALID_NCR, 0, "%s invalid numeric character reference %s" }, /* Error */
/* ReportEntityError */ /* ReportEntityError */
{ MISSING_SEMICOLON, 0, "entity \"%1$s\" doesn't end in ';'" }, /* Warning in HTML, Error in XML/XHTML */ { MISSING_SEMICOLON, 0, "entity \"%s\" doesn't end in ';'" }, /* Warning in HTML, Error in XML/XHTML */
{ MISSING_SEMICOLON_NCR, 0, "numeric character reference \"%1$s\" doesn't end in ';'" }, /* Warning in HTML, Error in XML/XHTML */ { MISSING_SEMICOLON_NCR, 0, "numeric character reference \"%s\" doesn't end in ';'" }, /* Warning in HTML, Error in XML/XHTML */
{ UNESCAPED_AMPERSAND, 0, "unescaped & which should be written as &amp;" }, /* Warning in HTML, Error in XHTML */ { UNESCAPED_AMPERSAND, 0, "unescaped & which should be written as &amp;" }, /* Warning in HTML, Error in XHTML */
{ UNKNOWN_ENTITY, 0, "unescaped & or unknown entity \"%1$s\"" }, /* Error */ { UNKNOWN_ENTITY, 0, "unescaped & or unknown entity \"%s\"" }, /* Error */
{ APOS_UNDEFINED, 0, "named entity &apos; only defined in XML/XHTML" }, /* Error in HTML (should only occur for HTML input) */ { APOS_UNDEFINED, 0, "named entity &apos; only defined in XML/XHTML" }, /* Error in HTML (should only occur for HTML input) */
/* ReportAttrError - attribute name */ /* ReportAttrError - attribute name */
{ INSERTING_ATTRIBUTE, 0, "%1$s inserting \"%2$s\" attribute" }, /* Warning in CheckLINK, Error otherwise */ { INSERTING_ATTRIBUTE, 0, "%s inserting \"%s\" attribute" }, /* Warning in CheckLINK, Error otherwise */
{ INSERTING_AUTO_ATTRIBUTE, 0, "%1$s inserting \"%2$s\" attribute using value \"%3$s\"" }, /* Warning */ { INSERTING_AUTO_ATTRIBUTE, 0, "%s inserting \"%s\" attribute using value \"%s\"" }, /* Warning */
{ MISSING_ATTR_VALUE, 0, "%1$s attribute \"%2$s\" lacks value" }, /* Warning in CheckUrl, Error otherwise */ { MISSING_ATTR_VALUE, 0, "%s attribute \"%s\" lacks value" }, /* Warning in CheckUrl, Error otherwise */
{ UNKNOWN_ATTRIBUTE, 0, "%1$s unknown attribute \"%2$s\"" }, /* Error */ { UNKNOWN_ATTRIBUTE, 0, "%s unknown attribute \"%s\"" }, /* Error */
{ PROPRIETARY_ATTRIBUTE, 0, "%1$s proprietary attribute \"%2$s\"" }, /* Error */ { PROPRIETARY_ATTRIBUTE, 0, "%s proprietary attribute \"%s\"" }, /* Error */
{ JOINING_ATTRIBUTE, 0, "%1$s joining values of repeated attribute \"%2$s\"" }, /* Error */ { JOINING_ATTRIBUTE, 0, "%s joining values of repeated attribute \"%s\"" }, /* Error */
{ XML_ATTRIBUTE_VALUE, 0, "%1$s has XML attribute \"%2$s\"" }, /* Error (but deprecated) */ { XML_ATTRIBUTE_VALUE, 0, "%s has XML attribute \"%s\"" }, /* Error (but deprecated) */
/* ReportAttrError - attribute value */ /* ReportAttrError - attribute value */
{ XML_ID_SYNTAX, 0, "%1$s ID \"%2$s\" uses XML ID syntax" }, /* Warning if XHTML, Error if HTML */ { XML_ID_SYNTAX, 0, "%s ID \"%s\" uses XML ID syntax" }, /* Warning if XHTML, Error if HTML */
{ ATTR_VALUE_NOT_LCASE, 0, "%1$s attribute value \"%2$s\" must be lower case for XHTML" }, /* Error if XHTML input, Notice if HTML input and XHTML outpout */ { ATTR_VALUE_NOT_LCASE, 0, "%s attribute value \"%s\" must be lower case for XHTML" }, /* Error if XHTML input, Notice if HTML input and XHTML outpout */
{ PROPRIETARY_ATTR_VALUE, 0, "%1$s proprietary attribute value \"%2$s\"" }, /* Error */ { PROPRIETARY_ATTR_VALUE, 0, "%s proprietary attribute value \"%s\"" }, /* Error */
{ ANCHOR_NOT_UNIQUE, 0, "%1$s anchor \"%2$s\" already defined" }, /* Error */ { ANCHOR_NOT_UNIQUE, 0, "%s anchor \"%s\" already defined" }, /* Error */
/* ReportAttrError - attribute name, attribute value */ /* ReportAttrError - attribute name, attribute value */
{ BAD_ATTRIBUTE_VALUE, 0, "%1$s attribute \"%2$s\" has invalid value \"%3$s\"" }, /* Error */ { BAD_ATTRIBUTE_VALUE, 0, "%s attribute \"%s\" has invalid value \"%s\"" }, /* Error */
{ BAD_ATTRIBUTE_VALUE_REPLACED, 0, "%1$s attribute \"%2$s\" had invalid value \"%3$s\" and has been replaced" }, /* Error */ { BAD_ATTRIBUTE_VALUE_REPLACED, 0, "%s attribute \"%s\" had invalid value \"%s\" and has been replaced" }, /* Error */
{ INVALID_ATTRIBUTE, 0, "%1$s attribute name \"%2$s\" (value=\"%3$s\") is invalid" }, /* Error */ { INVALID_ATTRIBUTE, 0, "%s attribute name \"%s\" (value=\"%s\") is invalid" }, /* Error */
/* ReportAttrError - attribute value, attribute name */ /* ReportAttrError - attribute value, attribute name */
{ REPEATED_ATTRIBUTE, 0, "%1$s dropping value \"%2$s\" for repeated attribute \"%3$s\"" }, /* Error */ { REPEATED_ATTRIBUTE, 0, "%s dropping value \"%s\" for repeated attribute \"%s\"" }, /* Error */
/* ReportAttrError - no arguments */ /* ReportAttrError - no arguments */
{ INVALID_XML_ID, 0, "%1$s cannot copy name attribute to id" }, /* Warning */ { INVALID_XML_ID, 0, "%s cannot copy name attribute to id" }, /* Warning */
{ UNEXPECTED_GT, 0, "%1$s missing '>' for end of tag" }, /* Warning if HTML, Error if XML/XHTML */ { UNEXPECTED_GT, 0, "%s missing '>' for end of tag" }, /* Warning if HTML, Error if XML/XHTML */
{ UNEXPECTED_QUOTEMARK, 0, "%1$s unexpected or duplicate quote mark" }, /* Error */ { UNEXPECTED_QUOTEMARK, 0, "%s unexpected or duplicate quote mark" }, /* Error */
{ MISSING_QUOTEMARK, 0, "%1$s attribute with missing trailing quote mark" }, /* Error */ { MISSING_QUOTEMARK, 0, "%s attribute with missing trailing quote mark" }, /* Error */
{ UNEXPECTED_END_OF_FILE_ATTR, 0, "%1$s end of file while parsing attributes" }, /* Error */ { UNEXPECTED_END_OF_FILE_ATTR, 0, "%s end of file while parsing attributes" }, /* Error */
{ ID_NAME_MISMATCH, 0, "%1$s id and name attribute value mismatch" }, /* Error */ { ID_NAME_MISMATCH, 0, "%s id and name attribute value mismatch" }, /* Error */
{ BACKSLASH_IN_URI, 0, "%1$s URI reference contains backslash. Typo?" }, /* Error */ { BACKSLASH_IN_URI, 0, "%s URI reference contains backslash. Typo?" }, /* Error */
{ FIXED_BACKSLASH, 0, "%1$s converting backslash in URI to slash" }, /* Error */ { FIXED_BACKSLASH, 0, "%s converting backslash in URI to slash" }, /* Error */
{ ILLEGAL_URI_REFERENCE, 0, "%1$s improperly escaped URI reference" }, /* Error */ { ILLEGAL_URI_REFERENCE, 0, "%s improperly escaped URI reference" }, /* Error */
{ ESCAPED_ILLEGAL_URI, 0, "%1$s escaping malformed URI reference" }, /* Error */ { ESCAPED_ILLEGAL_URI, 0, "%s escaping malformed URI reference" }, /* Error */
{ NEWLINE_IN_URI, 0, "%1$s discarding newline in URI reference" }, /* Error */ { NEWLINE_IN_URI, 0, "%s discarding newline in URI reference" }, /* Error */
{ WHITE_IN_URI, 0, "%1$s discarding whitespace in URI reference" }, /* Error */ { WHITE_IN_URI, 0, "%s discarding whitespace in URI reference" }, /* Error */
{ UNEXPECTED_EQUALSIGN, 0, "%1$s unexpected '=', expected attribute name" }, /* Error */ { UNEXPECTED_EQUALSIGN, 0, "%s unexpected '=', expected attribute name" }, /* Error */
{ MISSING_IMAGEMAP, 0, "%1$s should use client-side image map" }, /* Warning (but deprecated) */ { MISSING_IMAGEMAP, 0, "%s should use client-side image map" }, /* Warning (but deprecated) */
/* ReportMissingAttr */ /* ReportMissingAttr */
{ MISSING_ATTRIBUTE, 0, "%1$s lacks \"%2$s\" attribute" }, /* Error */ { MISSING_ATTRIBUTE, 0, "%s lacks \"%s\" attribute" }, /* Error */
/* ReportWarning */ /* ReportWarning */
{ NESTED_EMPHASIS, 0, "nested emphasis %1$s" }, /* Warning */ { NESTED_EMPHASIS, 0, "nested emphasis %s" }, /* Warning */
{ NESTED_QUOTATION, 0, "nested q elements, possible typo." }, /* Warning */ { NESTED_QUOTATION, 0, "nested q elements, possible typo." }, /* Warning */
{ OBSOLETE_ELEMENT, 0, "replacing obsolete element %1$s with %2$s" }, /* Warning */ { OBSOLETE_ELEMENT, 0, "replacing obsolete element %s with %s" }, /* Warning */
{ COERCE_TO_ENDTAG_WARN, 0, "<%1$s> is probably intended as </%2$s>" }, /* Warning */ { COERCE_TO_ENDTAG_WARN, 0, "<%s> is probably intended as </%s>" }, /* Warning */
{ REMOVED_HTML5, 0, "%1$s element removed from HTML5" }, /* Warning */ { REMOVED_HTML5, 0, "%s element removed from HTML5" }, /* Warning */
{ BAD_BODY_HTML5, 0, "Found attribute on body that is obsolete in HTML5. Use CSS" }, /* Warning */ { BAD_BODY_HTML5, 0, "Found attribute on body that is obsolete in HTML5. Use CSS" }, /* Warning */
{ BAD_ALIGN_HTML5, 0, "The align attribute on the %1$s element is obsolete. Use CSS" }, /* Warning */ { BAD_ALIGN_HTML5, 0, "The align attribute on the %s element is obsolete. Use CSS" }, /* Warning */
{ BAD_SUMMARY_HTML5, 0, "The summary attribute on the %1$s element is obsolete in HTML5" }, /* Warning */ { BAD_SUMMARY_HTML5, 0, "The summary attribute on the %s element is obsolete in HTML5" }, /* Warning */
/* ReportNotice */ /* ReportNotice */
{ TRIM_EMPTY_ELEMENT, 0, "trimming empty %1$s" }, /* Notice */ { TRIM_EMPTY_ELEMENT, 0, "trimming empty %s" }, /* Notice */
{ REPLACING_ELEMENT, 0, "replacing %1$s with %2$s" }, /* Notice */ { REPLACING_ELEMENT, 0, "replacing %s with %s" }, /* Notice */
/* ReportError */ /* ReportError */
{ COERCE_TO_ENDTAG, 0, "<%1$s> is probably intended as </%2$s>" }, /* Error */ { COERCE_TO_ENDTAG, 0, "<%s> is probably intended as </%s>" }, /* Error */
{ REPLACING_UNEX_ELEMENT, 0, "replacing unexpected %1$s with %2$s" }, /* Error */ { REPLACING_UNEX_ELEMENT, 0, "replacing unexpected %s with %s" }, /* Error */
{ MISSING_ENDTAG_FOR, 0, "missing </%1$s>" }, /* Error */ { MISSING_ENDTAG_FOR, 0, "missing </%s>" }, /* Error */
{ MISSING_ENDTAG_BEFORE, 0, "missing </%1$s> before %2$s" }, /* Error */ { MISSING_ENDTAG_BEFORE, 0, "missing </%s> before %s" }, /* Error */
{ DISCARDING_UNEXPECTED, 0, "discarding unexpected %1$s" }, /* Error */ { DISCARDING_UNEXPECTED, 0, "discarding unexpected %s" }, /* Error */
{ NON_MATCHING_ENDTAG, 0, "replacing unexpected %1$s with </%2$s>" }, /* Error */ { NON_MATCHING_ENDTAG, 0, "replacing unexpected %s with </%s>" }, /* Error */
{ TAG_NOT_ALLOWED_IN, 0, "%1$s isn't allowed in <%2$s> elements" }, /* Error */ { TAG_NOT_ALLOWED_IN, 0, "%s isn't allowed in <%s> elements" }, /* Error */
{ MISSING_STARTTAG, 0, "missing <%1$s>" }, /* Error */ { MISSING_STARTTAG, 0, "missing <%s>" }, /* Error */
{ UNEXPECTED_ENDTAG, 0, "unexpected </%1$s>" }, /* Error */ { UNEXPECTED_ENDTAG, 0, "unexpected </%s>" }, /* Error */
{ TOO_MANY_ELEMENTS, 0, "too many %1$s elements" }, /* Error */ { TOO_MANY_ELEMENTS, 0, "too many %s elements" }, /* Error */
{ USING_BR_INPLACE_OF, 0, "using <br> in place of %1$s" }, /* Error */ { USING_BR_INPLACE_OF, 0, "using <br> in place of %s" }, /* Error */
{ INSERTING_TAG, 0, "inserting implicit <%1$s>" }, /* Error */ { INSERTING_TAG, 0, "inserting implicit <%s>" }, /* Error */
{ CANT_BE_NESTED, 0, "%1$s can't be nested" }, /* Error */ { CANT_BE_NESTED, 0, "%s can't be nested" }, /* Error */
{ PROPRIETARY_ELEMENT, 0, "%1$s is not approved by W3C" }, /* Error */ { PROPRIETARY_ELEMENT, 0, "%s is not approved by W3C" }, /* Error */
{ ILLEGAL_NESTING, 0, "%1$s shouldn't be nested" }, /* Error */ { ILLEGAL_NESTING, 0, "%s shouldn't be nested" }, /* Error */
{ NOFRAMES_CONTENT, 0, "%1$s not inside 'noframes' element" }, /* Error */ { NOFRAMES_CONTENT, 0, "%s not inside 'noframes' element" }, /* Error */
{ UNEXPECTED_END_OF_FILE, 0, "unexpected end of file %1$s" }, /* Error */ { UNEXPECTED_END_OF_FILE, 0, "unexpected end of file %s" }, /* Error */
{ ELEMENT_NOT_EMPTY, 0, "%1$s element not empty or not closed" }, /* Error */ { ELEMENT_NOT_EMPTY, 0, "%s element not empty or not closed" }, /* Error */
{ UNEXPECTED_ENDTAG_IN, 0, "unexpected </%1$s> in <%2$s>" }, /* Error */ { UNEXPECTED_ENDTAG_IN, 0, "unexpected </%s> in <%s>" }, /* Error */
{ TOO_MANY_ELEMENTS_IN, 0, "too many %1$s elements in <%2$s>" }, /* Error */ { TOO_MANY_ELEMENTS_IN, 0, "too many %s elements in <%s>" }, /* Error */
{ UNESCAPED_ELEMENT, 0, "unescaped %1$s in pre content" }, /* Error (but deprecated) */ { UNESCAPED_ELEMENT, 0, "unescaped %s in pre content" }, /* Error (but deprecated) */
/* ReportError - no arguments */ /* ReportError - no arguments */
{ DOCTYPE_AFTER_TAGS, 0, "<!DOCTYPE> isn't allowed after elements" }, /* Error */ { DOCTYPE_AFTER_TAGS, 0, "<!DOCTYPE> isn't allowed after elements" }, /* Error */
@ -444,10 +442,10 @@ static languageDefinition language_en = { whichPluralForm_en, {
/* ReportFatal */ /* ReportFatal */
{ SUSPECTED_MISSING_QUOTE, 0, "missing quote mark for attribute value" }, /* Error? (not really sometimes) */ { SUSPECTED_MISSING_QUOTE, 0, "missing quote mark for attribute value" }, /* Error? (not really sometimes) */
{ DUPLICATE_FRAMESET, 0, "repeated FRAMESET element" }, /* Error */ { DUPLICATE_FRAMESET, 0, "repeated FRAMESET element" }, /* Error */
{ UNKNOWN_ELEMENT, 0, "%1$s is not recognized!" }, /* Error */ { UNKNOWN_ELEMENT, 0, "%s is not recognized!" }, /* Error */
/* Info */ /* Info */
{ PREVIOUS_LOCATION, 0, "<%1$s> previously mentioned" }, /* Info */ { PREVIOUS_LOCATION, 0, "<%s> previously mentioned" }, /* Info */
#if SUPPORT_ACCESSIBILITY_CHECKS #if SUPPORT_ACCESSIBILITY_CHECKS
@ -1594,7 +1592,7 @@ static languageDefinition language_en = { whichPluralForm_en, {
{ TC_LABEL_LANG, 0, "lang" }, { TC_LABEL_LANG, 0, "lang" },
{ TC_LABEL_LEVL, 0, "level" }, { TC_LABEL_LEVL, 0, "level" },
{ TC_LABEL_OPT, 0, "option" }, { TC_LABEL_OPT, 0, "option" },
{ TC_MAIN_ERROR_LOAD_CONFIG, 0, "Loading config file \"%1$s\" failed, err = %2$d" }, { TC_MAIN_ERROR_LOAD_CONFIG, 0, "Loading config file \"%s\" failed, err = %d" },
{ TC_OPT_ACCESS, 0, { TC_OPT_ACCESS, 0,
"do additional accessibility checks (<level> = 0, 1, 2, 3). 0 is " "do additional accessibility checks (<level> = 0, 1, 2, 3). 0 is "
"assumed if <level> is missing." "assumed if <level> is missing."
@ -1675,16 +1673,16 @@ static languageDefinition language_en = { whichPluralForm_en, {
TC_STRING_CONF_NOTE, 0, "Values marked with an *asterisk are calculated internally by HTML Tidy" TC_STRING_CONF_NOTE, 0, "Values marked with an *asterisk are calculated internally by HTML Tidy"
}, },
{ TC_STRING_OPT_NOT_DOCUMENTED, 0, "Warning: option `%1$s' is not documented." }, { TC_STRING_OPT_NOT_DOCUMENTED, 0, "Warning: option `%s' is not documented." },
{ TC_STRING_OUT_OF_MEMORY, 0, "Out of memory. Bailing out." }, { TC_STRING_OUT_OF_MEMORY, 0, "Out of memory. Bailing out." },
{ TC_STRING_FATAL_ERROR, 0, "Fatal error: impossible value for id='%1$d'." }, { TC_STRING_FATAL_ERROR, 0, "Fatal error: impossible value for id='%d'." },
{ TC_STRING_FILE_MANIP, 0, "File manipulation" }, { TC_STRING_FILE_MANIP, 0, "File manipulation" },
{ TC_STRING_PROCESS_DIRECTIVES, 0, "Processing directives" }, { TC_STRING_PROCESS_DIRECTIVES, 0, "Processing directives" },
{ TC_STRING_CHAR_ENCODING, 0, "Character encodings" }, { TC_STRING_CHAR_ENCODING, 0, "Character encodings" },
{ TC_STRING_LANG_MUST_SPECIFY, 0, "A POSIX or Windows locale must be specified." }, { TC_STRING_LANG_MUST_SPECIFY, 0, "A POSIX or Windows locale must be specified." },
{/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ {/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TC_STRING_LANG_NOT_FOUND, 0, "Tidy doesn't have language '%1$s,' will use '%2$s' instead." TC_STRING_LANG_NOT_FOUND, 0, "Tidy doesn't have language '%s,' will use '%s' instead."
}, },
{ TC_STRING_MISC, 0, "Miscellaneous" }, { TC_STRING_MISC, 0, "Miscellaneous" },
@ -1692,34 +1690,34 @@ static languageDefinition language_en = { whichPluralForm_en, {
{ TC_STRING_MUST_SPECIFY, 0, "A Tidy option name must be specified." }, { TC_STRING_MUST_SPECIFY, 0, "A Tidy option name must be specified." },
{/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ {/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TC_STRING_UNKNOWN_OPTION, 0, "HTML Tidy: unknown option: %1$c" TC_STRING_UNKNOWN_OPTION, 0, "HTML Tidy: unknown option: %c"
}, },
{/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ {/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TC_STRING_UNKNOWN_OPTION_B, 0, "HTML Tidy: unknown option." TC_STRING_UNKNOWN_OPTION_B, 0, "HTML Tidy: unknown option."
}, },
{/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ {/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TC_STRING_VERS_A, 0, "HTML Tidy for %1$s version %2$s" TC_STRING_VERS_A, 0, "HTML Tidy for %s version %s"
}, },
{/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ {/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TC_STRING_VERS_B, 0, "HTML Tidy version %1$s" TC_STRING_VERS_B, 0, "HTML Tidy version %s"
}, },
{/* This console output should be limited to 78 characters per line. {/* This console output should be limited to 78 characters per line.
- %1$n represents the name of the executable from the file system, and is mostly like going to be "tidy". - %n represents the name of the executable from the file system, and is mostly like going to be "tidy".
- %2$2 represents a version number, typically x.x.xx. - %2 represents a version number, typically x.x.xx.
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TC_TXT_HELP_1, 0, TC_TXT_HELP_1, 0,
"\n" "\n"
"%1$s [options...] [file...] [options...] [file...]\n" "%s [options...] [file...] [options...] [file...]\n"
"Utility to clean up and pretty print HTML/XHTML/XML.\n" "Utility to clean up and pretty print HTML/XHTML/XML.\n"
"\n" "\n"
"This is modern HTML Tidy version %2$s.\n" "This is modern HTML Tidy version %s.\n"
"\n" "\n"
}, },
{/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. {/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated.
- %1$s represents the platform, for example, "Mac OS X" or "Windows". */ - %s represents the platform, for example, "Mac OS X" or "Windows". */
TC_TXT_HELP_2A, 0, TC_TXT_HELP_2A, 0,
"Command Line Arguments for HTML Tidy for %1$s:" "Command Line Arguments for HTML Tidy for %s:"
}, },
{/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ {/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TC_TXT_HELP_2B, 0, TC_TXT_HELP_2B, 0,

View file

@ -1,4 +1,4 @@
#ifndef language_en_gb_h #ifndef language_en_gb_h
#define language_en_gb_h #define language_en_gb_h
/* /*
* language_en_gb.h * language_en_gb.h
@ -20,7 +20,7 @@
* *
* Orginating PO file metadata: * Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry * PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2016-01-23 16:04:27 * PO_REVISION_DATE=2016-01-26 14:38:30
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER

View file

@ -1,4 +1,4 @@
#ifndef language_es_h #ifndef language_es_h
#define language_es_h #define language_es_h
/* /*
* language_es.h * language_es.h
@ -20,7 +20,7 @@
* *
* Orginating PO file metadata: * Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry * PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2016-01-23 16:04:55 * PO_REVISION_DATE=2016-01-26 14:38:30
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
@ -61,26 +61,26 @@ static languageDefinition language_es = { whichPluralForm_es, {
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TEXT_GENERAL_INFO_PLEA, 0, TEXT_GENERAL_INFO_PLEA, 0,
"\n" "\n"
"\xc2\xbfLe gustar\xc3\xad""a ver Tidy en un espa\xc3\xb1ol correcto? Por favor considere \n" "¿Le gustaría ver Tidy en un español correcto? Por favor considere \n"
"ayudarnos a localizar HTML Tidy. Para m\xc3\xa1s detalles consulte \n" "ayudarnos a localizar HTML Tidy. Para más detalles consulte \n"
"https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md \n" "https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md \n"
}, },
{/* Please use _only_ <code></code>, <em></em>, <strong></strong>, and <br/>. {/* Please use _only_ <code></code>, <em></em>, <strong></strong>, and <br/>.
It's very important that <br/> be self-closing in this manner! It's very important that <br/> be self-closing in this manner!
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TidyMakeClean, 0, TidyMakeClean, 0,
"Esta opci\xc3\xb3n especifica si Tidy debe realizar la limpieza de alg\xc3\xban legado etiquetas de " "Esta opción especifica si Tidy debe realizar la limpieza de algún legado etiquetas de "
"presentaci\xc3\xb3n (actualmente <code>&lt;i&gt;</code>, <code>&lt;b&gt;</code>, <code>&lt;center&gt;</" "presentación (actualmente <code>&lt;i&gt;</code>, <code>&lt;b&gt;</code>, <code>&lt;center&gt;</"
"code> cuando encerrados dentro de las etiquetas apropiadas en l\xc3\xadnea y <code>&lt;font&gt;</" "code> cuando encerrados dentro de las etiquetas apropiadas en línea y <code>&lt;font&gt;</"
"code>). Si se establece en <code>yes</code>, entonces etiquetas existentes ser\xc3\xa1n reemplazados " "code>). Si se establece en <code>yes</code>, entonces etiquetas existentes serán reemplazados "
"con CSS <code>&lt;style&gt;</code> y estructural markup seg\xc3\xban corresponda. " "con CSS <code>&lt;style&gt;</code> y estructural markup según corresponda. "
}, },
#if SUPPORT_ASIAN_ENCODINGS #if SUPPORT_ASIAN_ENCODINGS
{/* Please use _only_ <code></code>, <em></em>, <strong></strong>, and <br/>. {/* Please use _only_ <code></code>, <em></em>, <strong></strong>, and <br/>.
It's very important that <br/> be self-closing in this manner! It's very important that <br/> be self-closing in this manner!
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TidyNCR, 0, "Esta opci\xc3\xb3n especifica si Tidy debe permitir referencias de caracteres num\xc3\xa9ricos. " TidyNCR, 0, "Esta opción especifica si Tidy debe permitir referencias de caracteres numéricos. "
}, },
#endif /* SUPPORT_ASIAN_ENCODINGS */ #endif /* SUPPORT_ASIAN_ENCODINGS */
@ -88,22 +88,22 @@ static languageDefinition language_es = { whichPluralForm_es, {
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TC_TXT_HELP_LANG_1, 0, TC_TXT_HELP_LANG_1, 0,
"\n" "\n"
"La opci\xc3\xb3n --language (o --lang) indica el lenguaje Tidy debe \n" "La opción --language (o --lang) indica el lenguaje Tidy debe \n"
"utilizar para comunicar su salida. Tenga en cuenta que esto no es \n" "utilizar para comunicar su salida. Tenga en cuenta que esto no es \n"
"un servicio de traducci\xc3\xb3n de documentos, y s\xc3\xb3lo afecta a los mensajes \n" "un servicio de traducción de documentos, y sólo afecta a los mensajes \n"
"que Tidy comunica a usted. \n" "que Tidy comunica a usted. \n"
"\n" "\n"
"Cuando se utiliza la l\xc3\xadnea de comandos el argumento --language debe \n" "Cuando se utiliza la línea de comandos el argumento --language debe \n"
"utilizarse antes de cualquier argumento que dan lugar a la producci\xc3\xb3n, \n" "utilizarse antes de cualquier argumento que dan lugar a la producción, \n"
"de lo contrario Tidy producir\xc3\xa1 la salida antes de que se conozca el \n" "de lo contrario Tidy producirá la salida antes de que se conozca el \n"
"idioma a utilizar. \n" "idioma a utilizar. \n"
"\n" "\n"
"Adem\xc3\xa1s de los c\xc3\xb3""digos de idioma est\xc3\xa1ndar POSIX, Tidy es capaz de \n" "Además de los códigos de idioma estándar POSIX, Tidy es capaz de \n"
"entender c\xc3\xb3""digos de idioma legados de Windows. Tenga en cuenta que \n" "entender códigos de idioma legados de Windows. Tenga en cuenta que \n"
"este lista indica los c\xc3\xb3""digos Tidy entiende, y no indica que \n" "este lista indica los códigos Tidy entiende, y no indica que \n"
"actualmente el idioma est\xc3\xa1 instalado. \n" "actualmente el idioma está instalado. \n"
"\n" "\n"
"La columna m\xc3\xa1s a la derecha indica c\xc3\xb3mo Tidy comprender\xc3\xa1 el \n" "La columna más a la derecha indica cómo Tidy comprenderá el \n"
"legado nombre de Windows.\n" "legado nombre de Windows.\n"
"\n" "\n"
}, },
@ -111,23 +111,23 @@ static languageDefinition language_es = { whichPluralForm_es, {
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TC_TXT_HELP_LANG_2, 0, TC_TXT_HELP_LANG_2, 0,
"\n" "\n"
"Los siguientes idiomas est\xc3\xa1n instalados actualmente en Tidy. Tenga \n" "Los siguientes idiomas están instalados actualmente en Tidy. Tenga \n"
"en cuenta que no hay garant\xc3\xad""a de que est\xc3\xa1n completos; s\xc3\xb3lo quiere decir \n" "en cuenta que no hay garantía de que están completos; sólo quiere decir \n"
"que un desarrollador u otro comenzaron a a\xc3\xb1""adir el idioma indicado. \n" "que un desarrollador u otro comenzaron a añadir el idioma indicado. \n"
"\n" "\n"
"Localizaciones incompletas por defecto se usan \"en\" cuando sea \n" "Localizaciones incompletas por defecto se usan \"en\" cuando sea \n"
"necesario. \xc2\xa1""Favor de informar los desarrolladores de estes casos! \n" "necesario. ¡Favor de informar los desarrolladores de estes casos! \n"
"\n" "\n"
}, },
{/* This console output should be limited to 78 characters per line. {/* This console output should be limited to 78 characters per line.
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TC_TXT_HELP_LANG_3, 0, TC_TXT_HELP_LANG_3, 0,
"\n" "\n"
"Si Tidy es capaz de determinar la configuraci\xc3\xb3n regional entonces \n" "Si Tidy es capaz de determinar la configuración regional entonces \n"
"Tidy utilizar\xc3\xa1 el lenguaje de forma autom\xc3\xa1tica de la configuraci\xc3\xb3n \n" "Tidy utilizará el lenguaje de forma automática de la configuración \n"
"regional. Por ejemplo los sistemas de tipo Unix utilizan los variables \n" "regional. Por ejemplo los sistemas de tipo Unix utilizan los variables \n"
"$LANG y/o $LC_ALL. Consulte a su documentaci\xc3\xb3n del sistema para \n" "$LANG y/o $LC_ALL. Consulte a su documentación del sistema para \n"
"obtener m\xc3\xa1s informaci\xc3\xb3n.\n" "obtener más información.\n"
"\n" "\n"
}, },

View file

@ -1,4 +1,4 @@
#ifndef language_es_mx_h #ifndef language_es_mx_h
#define language_es_mx_h #define language_es_mx_h
/* /*
* language_es_mx.h * language_es_mx.h
@ -20,7 +20,7 @@
* *
* Orginating PO file metadata: * Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry * PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2016-01-23 16:04:41 * PO_REVISION_DATE=2016-01-26 14:38:30
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
@ -61,8 +61,8 @@ static languageDefinition language_es_mx = { whichPluralForm_es_mx, {
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TEXT_GENERAL_INFO_PLEA, 0, TEXT_GENERAL_INFO_PLEA, 0,
"\n" "\n"
"\xc2\xbfLe gustar\xc3\xad""a ver Tidy en adecuada, espa\xc3\xb1ol mexicano? Por favor considere \n" "¿Le gustaría ver Tidy en adecuada, español mexicano? Por favor considere \n"
"ayudarnos a localizar HTML Tidy. Para m\xc3\xa1s detalles consulte \n" "ayudarnos a localizar HTML Tidy. Para más detalles consulte \n"
"https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md \n" "https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md \n"
}, },

View file

@ -1,4 +1,4 @@
#ifndef language_zh_cn_h #ifndef language_zh_cn_h
#define language_zh_cn_h #define language_zh_cn_h
/* /*
* language_zh_cn.h * language_zh_cn.h
@ -20,7 +20,7 @@
* *
* Orginating PO file metadata: * Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry * PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2016-01-23 16:05:15 * PO_REVISION_DATE=2016-01-26 14:38:30
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
@ -57,14 +57,14 @@ static languageDefinition language_zh_cn = { whichPluralForm_zh_cn, {
{/* Specify the ll or ll_cc language code here. */ {/* Specify the ll or ll_cc language code here. */
TIDY_LANGUAGE, 0, "zh_cn" TIDY_LANGUAGE, 0, "zh_cn"
}, },
{ FILE_CANT_OPEN, 0, "\xe6\x97\xa0\xe6\xb3\x95\xe6\x89\x93\xe5\xbc\x80\xe2\x80\x9d%1$s\xe2\x80\x9d\n" }, { FILE_CANT_OPEN, 0, "无法打开”%s”\n" },
{ LINE_COLUMN_STRING, 0, "\xe8\xa1\x8c %1$d \xe5\x88\x97 %2$d - " }, { LINE_COLUMN_STRING, 0, "行 %d 列 %d - " },
{ STRING_CONTENT_LOOKS, 0, "\xe6\x96\x87\xe6\xa1\xa3\xe5\x86\x85\xe5\xae\xb9\xe7\x9c\x8b\xe8\xb5\xb7\xe6\x9d\xa5\xe5\x83\x8f %1$s" }, { STRING_CONTENT_LOOKS, 0, "文档内容看起来像 %s" },
{/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ {/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TC_STRING_VERS_A, 0, "HTML Tidy \xe7\x89\x88\xe6\x9c\xac %2$s \xe7\x94\xa8\xe4\xba\x8e %1$s" TC_STRING_VERS_A, 0, "HTML Tidy 用于 %s 版本 %s"
}, },
{/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ {/* The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TC_STRING_VERS_B, 0, "HTML Tidy \xe7\x89\x88\xe6\x9c\xac %1$s" TC_STRING_VERS_B, 0, "HTML Tidy 版本 %s"
}, },
{/* This MUST be present and last. */ {/* This MUST be present and last. */

View file

@ -8,9 +8,6 @@
#include "forward.h" #include "forward.h"
#include "tmbstr.h" #include "tmbstr.h"
#include "lexer.h" #include "lexer.h"
#if defined(_WIN32)
#include "win_vsnprintf.h"
#endif
/* like strdup but using an allocator */ /* like strdup but using an allocator */
tmbstr TY_(tmbstrdup)( TidyAllocator *allocator, ctmbstr str ) tmbstr TY_(tmbstrdup)( TidyAllocator *allocator, ctmbstr str )

View file

@ -1,129 +0,0 @@
/* win_vsnprintf.h -- Provides standard vsnprintf.h and
* additional printf routines to Tidy on Windows.
*
* Created by Jim Derry on 1/8/16.
* (c) 2016 HTACG
* See tidy.h and access.h for the copyright notice.
*/
#include <stdio.h>
#include <stdarg.h>
#include "forward.h"
#include "win_vsnprintf.h"
#if defined(__MINGW32__)
/* minGW.org doesn't automatically include these in its `libmsvcrt.a` although
* `dumpbin /exports C:\Windows\System32\msvcrt.dll` indicates they are present.
* We include our own import library `libmsvcrt_tidy.a` that adds these missing
* definitions.
*
* Unfortunately `msvcrt.dll` only includes `_vscprintf_p_l` for some strange
* reason, which takes a locale_t which is not available to minGW. Since we're
* going to pass NULL anyway, we can import it as a void*.
*/
extern int _vscprintf_p_l(const char *fmt, void *locale, va_list ap);
extern int _vsprintf_p(char *s, uint n, const char *fmt, va_list ap);
#endif
#if defined(_WIN32)
static char* TY_(new_string)( const ctmbstr fmt, va_list args );
/* Provides a proper `vsnprintf` for Windows including correct return
* values and with support for positional arguments.
* Adapted from FFmpeg -- LGPL
*/
int TY_(win_vsnprintf)(char *s, uint n, const char *fmt, va_list ap)
{
int ret;
va_list ap_copy;
if (n == 0)
return _vscprintf_p_l(fmt, NULL, ap);
memset(s, 0, n);
va_copy(ap_copy, ap);
ret = _vsprintf_p(s, n, fmt, ap_copy);
va_end(ap_copy);
if (ret == -1)
ret = _vscprintf(fmt, ap);
return ret;
}
/* Provides a proper `snprintf` for Windows including correct return
* values and with support for positional arguments.
*/
int TY_(win_snprintf)(char *s, uint n, const char *fmt, ...)
{
int retval;
va_list args;
va_start(args, fmt);
retval = TY_(win_vsnprintf)(s, n, fmt, args);
va_end(args);
return retval;
}
/* Provides a wrapper for `printf` using the improved `vsnprintf`. */
int TY_(win_printf)(const char *s, ...)
{
int result;
char *out_string;
va_list args;
va_start(args, s);
out_string = TY_(new_string)( s, args );
va_end(args);
result = printf("%s", out_string);
if (out_string)
free(out_string);
return result;
}
/* Provides a wrapper for `fprintf` using the improved `vsnprintf`. */
int TY_(win_fprintf)(FILE *f, const char *s, ...)
{
int result;
char *out_string;
va_list args;
va_start(args, s);
out_string = TY_(new_string)( s, args );
va_end(args);
result = fprintf(f, "%s", out_string);
if (out_string)
free(out_string);
return result;
}
/* Convenience to create a new string with a format and arguments.
*/
static char* TY_(new_string)( const ctmbstr fmt, va_list args )
{
char *result = NULL;
int len = 0;
len = TY_(win_vsnprintf)( result, 0, fmt, args );
if (!(result = malloc( len + 1) ))
{ /* @todo */
fprintf(stderr, "MALLOC FAILED in win_vsnprintf.c creating a new string!");
exit(2);
}
TY_(win_vsnprintf)( result, len + 1, fmt, args );
return result;
}
#endif /* defined(_WIN32) */

View file

@ -1,40 +0,0 @@
#ifndef __win_vsnprintf_h__
#define __win_vsnprintf_h__
/* win_vsnprintf.h -- Provides standard vsnprintf.h and
* additional printf routines to Tidy on Windows.
*
* Created by Jim Derry on 1/8/16.
* (c) 2016 HTACG
* See tidy.h and access.h for the copyright notice.
*/
#if defined(_WIN32)
#include <stdio.h>
#include "tidyplatform.h"
#include "forward.h"
/* Provides a proper `vsnprintf` for Windows including correct return
* values and with support for positional arguments.
*/
int TY_(win_vsnprintf)(char *s, uint n, const char *fmt, va_list ap);
/* Provides a proper `snprintf` for Windows including correct return
* values and with support for positional arguments.
*/
int TY_(win_snprintf)(char *s, uint n, const char *fmt, ...);
/* Provides a wrapper for `printf` using the improved `vsnprintf`. */
int TY_(win_printf)(const char *s, ...);
/* Provides a wrapper for `fprintf` using the improved `vsnprintf`. */
int TY_(win_fprintf)(FILE *f, const char *s, ...);
#endif /* defined(_WIN32) */
#endif /* __win_vsnprintf_h_ */