From 3c6b158ce25fcdaa08def37f9c37a733e6749fba Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Sun, 2 Nov 2014 14:35:16 +0100 Subject: [PATCH 1/6] update gitignore just in case someone wants to commit its personal `.transifexrc` file with login credentials to transifex.com --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 67169d997..71094b2af 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ ######################### #### GENERAL or ROOT #### ######################### + +# Transifex +.transifexrc + # Maven target/ From 7d930f46176eebcf588ef2e241f4e62935df41a3 Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Sun, 2 Nov 2014 14:36:14 +0100 Subject: [PATCH 2/6] initial transifex config for epubcheck project --- .tx/config | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .tx/config diff --git a/.tx/config b/.tx/config new file mode 100644 index 000000000..8d572cbdd --- /dev/null +++ b/.tx/config @@ -0,0 +1,33 @@ +[main] +host = https://www.transifex.com +minimum_perc = 50 + +[epubcheck.ErrorsWarnings] +file_filter = src/main/resources/com/adobe/epubcheck/messages/MessageBundle_.properties +source_file = src/main/resources/com/adobe/epubcheck/messages/MessageBundle.properties +source_lang = en +type = UNICODEPROPERTIES + +[epubcheck.CommandlineMessages] +file_filter = src/main/resources/com/adobe/epubcheck/util/messages_.properties +source_file = src/main/resources/com/adobe/epubcheck/util/messages.properties +source_lang = en +type = UNICODEPROPERTIES + +[epubcheck.CssParser] +file_filter = src/main/resources/org/idpf/epubcheck/util/css/messages_.properties +source_file = src/main/resources/org/idpf/epubcheck/util/css/messages.properties +source_lang = en +type = UNICODEPROPERTIES + +[epubcheck.jing-xsd-validation] +file_filter = src/main/resources/com/thaiopensource/datatype/xsd/resources/Messages_.properties +source_file = src/main/resources/com/thaiopensource/datatype/xsd/resources/Messages.properties +source_lang = en +type = PROPERTIES + +[epubcheck.jing-relaxng-validation] +file_filter = src/main/resources/com/thaiopensource/relaxng/pattern/resources/Messages_.properties +source_file = src/main/resources/com/thaiopensource/relaxng/pattern/resources/Messages.properties +source_lang = en +type = PROPERTIES From 8659d7537798d7c269b61d1c88cc385bb3dd10fc Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Sun, 2 Nov 2014 14:53:38 +0100 Subject: [PATCH 3/6] add original Jing messages.properties files for better transifex support extracted from jing-20120724.0.0.jar --- .tx/config | 33 ----- .../xsd/resources/Messages.properties | 61 ++++++++ .../pattern/resources/Messages.properties | 138 ++++++++++++++++++ 3 files changed, 199 insertions(+), 33 deletions(-) delete mode 100644 .tx/config create mode 100644 src/main/resources/com/thaiopensource/datatype/xsd/resources/Messages.properties create mode 100644 src/main/resources/com/thaiopensource/relaxng/pattern/resources/Messages.properties diff --git a/.tx/config b/.tx/config deleted file mode 100644 index 8d572cbdd..000000000 --- a/.tx/config +++ /dev/null @@ -1,33 +0,0 @@ -[main] -host = https://www.transifex.com -minimum_perc = 50 - -[epubcheck.ErrorsWarnings] -file_filter = src/main/resources/com/adobe/epubcheck/messages/MessageBundle_.properties -source_file = src/main/resources/com/adobe/epubcheck/messages/MessageBundle.properties -source_lang = en -type = UNICODEPROPERTIES - -[epubcheck.CommandlineMessages] -file_filter = src/main/resources/com/adobe/epubcheck/util/messages_.properties -source_file = src/main/resources/com/adobe/epubcheck/util/messages.properties -source_lang = en -type = UNICODEPROPERTIES - -[epubcheck.CssParser] -file_filter = src/main/resources/org/idpf/epubcheck/util/css/messages_.properties -source_file = src/main/resources/org/idpf/epubcheck/util/css/messages.properties -source_lang = en -type = UNICODEPROPERTIES - -[epubcheck.jing-xsd-validation] -file_filter = src/main/resources/com/thaiopensource/datatype/xsd/resources/Messages_.properties -source_file = src/main/resources/com/thaiopensource/datatype/xsd/resources/Messages.properties -source_lang = en -type = PROPERTIES - -[epubcheck.jing-relaxng-validation] -file_filter = src/main/resources/com/thaiopensource/relaxng/pattern/resources/Messages_.properties -source_file = src/main/resources/com/thaiopensource/relaxng/pattern/resources/Messages.properties -source_lang = en -type = PROPERTIES diff --git a/src/main/resources/com/thaiopensource/datatype/xsd/resources/Messages.properties b/src/main/resources/com/thaiopensource/datatype/xsd/resources/Messages.properties new file mode 100644 index 000000000..d9983a341 --- /dev/null +++ b/src/main/resources/com/thaiopensource/datatype/xsd/resources/Messages.properties @@ -0,0 +1,61 @@ +# Properties file specifying messages +enumeration_param=\"enumeration\" facet is not allowed as a parameter: use \"value\" element instead +whiteSpace_param=\"whiteSpace\" facet is not allowed as a parameter +unrecognized_param=unrecognized parameter \"{0}\" +invalid_regex=invalid regular expression: {0} +not_ordered=parameter can only be applied to ordered datatype +invalid_limit=\"{0}\" is not allowed by the base type: {1} +no_length=base datatype does not define a units of length +scale_not_derived_from_decimal=\"scale\" parameter can only be applied to datatype derived from \"decimal\" +scale_not_non_negative_integer=\"scale\" parameter must be non negative integer +length_not_non_negative_integer=\"length\" parameter must be non negative integer +precision_not_derived_from_decimal=\"precision\" parameter can only be applied to datatype derived from \"decimal\" +precision_not_positive_integer=\"precision\" parameter must be positive integer +regex_impl_not_found=cannot find regular expression implementation; use JDK 1.4 or add Xerces2 to your classpath +regex_internal_error=internal error in regular expression for datatype {0} + +# validation errors +length_violation=must be {0} with length equal to {1} (actual length was {2}) +max_length_violation=must be {0} with length at most {1} (actual length was {2}) +min_length_violation=must be {0} with length at least {1} (actual length was {2}) +min_inclusive_violation=must be {0} greater than or equal to {1} +min_exclusive_violation=must be {0} greater than {1} +max_inclusive_violation=must be {0} less than or equal to {1} +max_exclusive_violation=must be {0} less than {1} +pattern_violation=must be {0} matching the regular expression \"{1}\" +entity_violation=must be a name declared in the DTD as an unparsed entity +undeclared_prefix=must be a QName whose prefix, if any, is declared (prefix \"{0}\" is not declared) +precision_violation=must be {0} with at most {1} significant digits (found {2} digits) +precision_1_violation=must be {0} with exactly one significant digit (found {1} digits) +# part of the point is to avoid ugly "digit(s)" in the error message +scale_violation=must be a decimal number with at most {0} significant digits after the decimal point (found {1} digits) +scale_0_violation=must be a decimal number without any significant digits after the decimal point +scale_1_violation=must be a decimal number with at most one significant digit after the decimal point (found {0} digits) +lexical_violation=must be {0} + +# fragments substituted in above +lexical_space_string=a string +lexical_space_uri=a URI +lexical_space_boolean=a boolean +lexical_space_decimal=a decimal number +lexical_space_float=a floating-point number +lexical_space_duration=a duration +lexical_space_hex=a hexadecimal string +lexical_space_base64=a base64 string +lexical_space_integer=an integer +lexical_space_name=an XML name +lexical_space_ncname=an XML name without colons +lexical_space_nmtoken=an XML NMTOKEN +lexical_space_qname=an XML QName +lexical_space_list=a whitespace-delimited list +lexical_space_list_ncname=a list of XML names without colons +lexical_space_list_nmtoken=a list of XML NMTOKENs +lexical_space_date_y_m_d_time=an ISO date and time +lexical_space_time=an ISO time +lexical_space_date_y_m_d=an ISO date +lexical_space_date_y_m=an ISO year and month +lexical_space_date_y=a year +lexical_space_date_m_d=an ISO month and day (of the form --MM-DD) +lexical_space_date_m=an ISO month (of the form --MM) +lexical_space_date_d=an ISO day of the month (of the form ---DD) +lexical_space_language=an RFC 3066 language identifier \ No newline at end of file diff --git a/src/main/resources/com/thaiopensource/relaxng/pattern/resources/Messages.properties b/src/main/resources/com/thaiopensource/relaxng/pattern/resources/Messages.properties new file mode 100644 index 000000000..6afb9a12d --- /dev/null +++ b/src/main/resources/com/thaiopensource/relaxng/pattern/resources/Messages.properties @@ -0,0 +1,138 @@ +# Properties file specifying messages +illegal_href_attribute=illegal \"href\" attribute +ns_attribute_ignored=\"ns\" attribute ignored +reference_to_undefined=reference to undefined pattern \"{0}\" +missing_start_element=missing \"start\" element +recursive_reference=bad recursive reference to pattern \"{0}\" +recursive_include=recursive inclusion of URL \"{0}\" +duplicate_define=multiple definitions of \"{0}\" without \"combine\" attribute +duplicate_start=multiple definitions of start without \"combine\" attribute +conflict_combine_define=conflicting values of \"combine\" attribute for definition of \"{0}\" +conflict_combine_start=conflicting values of \"combine\" attribute for definition of start +missing_start_replacement=\"start\" in \"include\" does not override anything +missing_define_replacement=definition of \"{0}\" in \"include\" does not override anything +interleave_string=interleave of \"string\" or \"data\" element +group_string=group of \"string\" or \"data\" element +one_or_more_string=repeat of \"string\" or \"data\" element +unrecognized_datatype=datatype \"{1}\" from library \"{0}\" not recognized +unsupported_datatype_detail=datatype \"{1}\" from library \"{0}\" not supported: {2} +unrecognized_datatype_library=datatype library \"{0}\" not recognized +unrecognized_builtin_datatype=no such builtin datatype \"{0}\": must be \"string\" or \"token\" +invalid_value=\"{0}\" is not a valid value of the datatype +parent_ref_outside_grammar=reference to non-existent parent grammar +ref_outside_grammar=reference to non-existent grammar +expected_one_name_class=found \"{0}\" element but expected no further content +builtin_param=builtin datatypes do not have any parameters +invalid_param_display=invalid parameter:\n{0} +invalid_param_detail_display=invalid parameter: {0}:\n{1} +display_param={0}>>>>{1} +invalid_param_detail=invalid parameter: {0} +invalid_param=invalid parameter +invalid_params_detail=invalid parameters: {0} +invalid_params=invalid parameters +datatype_requires_parameter=datatype cannot be used without parameters +datatype_requires_parameter_detail=datatype cannot be used without parameters: {0} + +attribute_contains_attribute=an attribute pattern must not contain an attribute pattern (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path attribute//attribute) +attribute_contains_element=an attribute pattern must not contain an element pattern (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path attribute//ref) +data_except_contains_attribute=a data pattern must not exclude an attribute pattern (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path data/except//attribute) +data_except_contains_element=a data pattern must not exclude an element pattern (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path data/except//ref) +data_except_contains_empty=a data pattern must not exclude an empty pattern (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path data/except//empty) +data_except_contains_group=a data pattern must not exclude a group (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path data/except//group) +data_except_contains_interleave=a data pattern must not exclude an interleaved group (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path data/except//interleave) +data_except_contains_list=a data pattern must not exclude a list pattern (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path data/except//list) +data_except_contains_one_or_more=a data pattern must not exclude a repetition (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path data/except//oneOrMore) +data_except_contains_text=a data pattern must not exclude a text pattern (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path data/except//text) +list_contains_attribute=a list pattern must not contain an attribute pattern (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path list//attribute) +list_contains_element=a list pattern must not contain an element pattern (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path list//ref) +list_contains_list=a list pattern must not contain a list pattern (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path list//list) +list_contains_text=a list pattern must not contain a text pattern (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path list//text) +list_contains_interleave=a list pattern must not contain an interleave pattern (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path list//interleave) +one_or_more_contains_group_contains_attribute=a group of attributes must not be repeatable (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path oneOrMore//group//attribute) +one_or_more_contains_interleave_contains_attribute=an interleaved group of attributes must not be repeatable (section 7.1 of the RELAX NG specification requires that the simplified XML form of the schema not contain any elements matching the path oneOrMore//interleave//attribute) +start_contains_attribute=found element matching the prohibited path start//attribute in the simplified XML form of the schema (see section 7.1 of the RELAX NG specification) +start_contains_data=found element matching the prohibited path start//data in the simplified XML form of the schema (see section 7.1 of the RELAX NG specification) +start_contains_empty=found element matching the prohibited path start//empty in the simplified XML form of the schema (see section 7.1 of the RELAX NG specification) +start_contains_group=found element matching the prohibited path start//group in the simplified XML form of the schema (see section 7.1 of the RELAX NG specification) +start_contains_interleave=found element matching the prohibited path start//interleave in the simplified XML form of the schema (see section 7.1 of the RELAX NG specification) +start_contains_list=found element matching the prohibited path start//list in the simplified XML form of the schema (see section 7.1 of the RELAX NG specification) +start_contains_one_or_more=found element matching the prohibited path start//oneOrMore in the simplified XML form of the schema (see section 7.1 of the RELAX NG specification) +start_contains_text=found element matching the prohibited path start//text in the simplified XML form of the schema (see section 7.1 of the RELAX NG specification) +start_contains_value=found element matching the prohibited path start//value in the simplified XML form of the schema (see section 7.1 of the RELAX NG specification) +duplicate_attribute=duplicate attribute +duplicate_attribute_name=duplicate attribute {0} +duplicate_attribute_ns=attributes from namespace \"{0}\" can occur more than once +interleave_element_overlap=overlapping element names in operands of \"interleave\" +interleave_element_overlap_name=the element {0} can occur in more than one operand of \"interleave\" +interleave_element_overlap_ns=elements from namespace \"{0}\" can occur in more than one operand of \"interleave\" +interleave_text_overlap=both operands of \"interleave\" contain \"text\" +open_name_class_not_repeated=attribute using \"nsName\" or \"anyName\" must be in \"oneOrMore\" +xmlns_uri_attribute=attribute must not have namespace URI \"http://www.w3.org/2000/xmlns\" +xmlns_attribute=attribute must not be named \"xmlns\" + +# Validation errors +unknown_element=element {0} not allowed anywhere{1} +unexpected_element_required_element_missing=element {0} not allowed yet; missing required element {1} +unexpected_element_required_elements_missing=element {0} not allowed yet; missing required elements {1} +element_not_allowed_yet=element {0} not allowed yet{1} +out_of_context_element=element {0} not allowed here{1} +no_attributes_allowed=found attribute {0}, but no attributes allowed here +invalid_attribute_name=attribute {0} not allowed here{1} +invalid_attribute_value=value of attribute {0} is invalid{1} +required_attributes_missing_expected=element {0} missing one or more required attributes{1} +required_attribute_missing=element {0} missing required attribute {1} +required_attributes_missing=element {0} missing required attributes {1} +incomplete_element_required_elements_missing_expected=element {0} incomplete{1} +incomplete_element_required_element_missing=element {0} incomplete; missing required element {1} +incomplete_element_required_elements_missing=element {0} incomplete; missing required elements {1} +text_not_allowed=text not allowed here{0} +document_incomplete=document incompletely matched +invalid_element_value=character content of element {0} invalid{1} +blank_not_allowed=empty content for element {0} not allowed{1} +schema_allows_nothing=schema does not allow anything: it is equivalent to + +# ID correctness errors +id_element_name_class=an \"element\" pattern containing an \"attribute\" pattern with a non-null ID-type must have a name class that contains only \"choice\" and \"name\" elements +id_attribute_name_class=an \"attribute\" pattern with a non-null ID-type must have a name class that is a single name +id_parent=a \"data\" or \"value\" pattern with non-null ID-type must occur as the child of an \"attribute\" pattern +id_type_conflict=conflicting ID-types for attribute {1} of element {0} + +# ID soundness errors +id_no_tokens=value of attribute of type ID contained no tokens +id_multiple_tokens=value of attribute of type ID contained multiple tokens +idref_no_tokens=value of attribute of type IDREF contained no tokens +idref_multiple_tokens=value of attribute of type IDREF contained multiple tokens +idrefs_no_tokens=value of attribute of type IDREFS contained no tokens +missing_id=IDREF \"{0}\" without matching ID +duplicate_id=ID \"{0}\" has already been defined +first_id=first occurrence of ID \"{0}\" + +# Fragments +name_absent_namespace=\"{0}\" +name_with_namespace=\"{1}\" from namespace \"{0}\" +qname=\"{0}\" +qnames_nsdecls={0} (with {1}) +or_list_pair={0} or {1} +or_list_many_first={0} +or_list_many_middle={0}, {1} +or_list_many_last={0} or {1} +and_list_pair={0} and {1} +and_list_many_first={0} +and_list_many_middle={0}, {1} +and_list_many_last={0} and {1} + +expected=; expected {0} +element_end_tag=the element end-tag +text=text +data=data +element_list=element {0} +element_other_ns=an element from another namespace +expected_attribute=; expected attribute {0} +expected_attribute_or_other_ns=; expected attribute {0} or an attribute from another namespace +data_failures=; {0} +token_failures=; token {0} invalid; {1} +missing_token=; missing token; {0} +expected_data=; expected data +require_values=must be equal to {0} +require_qnames=must be a QName equal to {0} +require_datatype=must be a valid instance of datatype {0} From e2796b240b4cd91ce0256a723c9ebe78cbdd5ace Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Sun, 2 Nov 2014 14:57:07 +0100 Subject: [PATCH 4/6] exclude original Jing messages.properties files in maven build as they're already part of the Jing Library (jar) --- pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pom.xml b/pom.xml index de4d655c2..e97a40c74 100644 --- a/pom.xml +++ b/pom.xml @@ -233,6 +233,8 @@ src/main/resources com/adobe/epubcheck/schema/30/*.sch + com/thaiopensource/relaxng/pattern/resources/Messages.properties + com/thaiopensource/datatype/xsd/resources/Messages.properties From 4c253962d36c5b5fa55388c455469d1b57fd766c Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Sat, 26 Sep 2015 12:46:49 +0200 Subject: [PATCH 5/6] updated transifex config file accidentally deleted in 8659d753 --- .tx/config | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .tx/config diff --git a/.tx/config b/.tx/config new file mode 100644 index 000000000..3bb8eb8c9 --- /dev/null +++ b/.tx/config @@ -0,0 +1,39 @@ +[main] +host = https://www.transifex.com +minimum_perc = 50 + +[epubcheck.ErrorsWarnings] +file_filter = src/main/resources/com/adobe/epubcheck/messages/MessageBundle_.properties +source_file = src/main/resources/com/adobe/epubcheck/messages/MessageBundle.properties +source_lang = en +type = UNICODEPROPERTIES + +[epubcheck.CommandlineMessages] +file_filter = src/main/resources/com/adobe/epubcheck/util/messages_.properties +source_file = src/main/resources/com/adobe/epubcheck/util/messages.properties +source_lang = en +type = UNICODEPROPERTIES + +[epubcheck.CssParser] +file_filter = src/main/resources/org/idpf/epubcheck/util/css/messages_.properties +source_file = src/main/resources/org/idpf/epubcheck/util/css/messages.properties +source_lang = en +type = UNICODEPROPERTIES + +[epubcheck.jing-xsd-validation] +file_filter = src/main/resources/com/thaiopensource/datatype/xsd/resources/Messages_.properties +source_file = src/main/resources/com/thaiopensource/datatype/xsd/resources/Messages.properties +source_lang = en +type = PROPERTIES + +[epubcheck.jing-relaxng-validation] +file_filter = src/main/resources/com/thaiopensource/relaxng/pattern/resources/Messages_.properties +source_file = src/main/resources/com/thaiopensource/relaxng/pattern/resources/Messages.properties +source_lang = en +type = PROPERTIES + +[epubcheck.jing-schematron-validation] +file_filter = src/main/resources/com/thaiopensource/validate/schematron/resources/Messages_.properties +source_file = src/main/resources/com/thaiopensource/validate/schematron/resources/Messages.properties +source_lang = en +type = PROPERTIES From f3c67b4ba3e567940572a1de8e2df8d2140b9211 Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Fri, 9 Oct 2015 23:46:56 +0200 Subject: [PATCH 6/6] bash script to pull + normalize Transifex translations To run this script you need to have a Transifex account and install the Transifex Commandline Client! Instructions: http://docs.transifex.com/client/ You need to run this script from the repository's root directory! e.g. ./src/build/transifex-pull.sh --all usage: transifex-pull.sh [--all | <2-digit-country-code>] examples: transifex-pull.sh --all transifex-pull.sh de Note: tested on Mac OS X only! --- src/build/transifex-pull.sh | 92 +++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100755 src/build/transifex-pull.sh diff --git a/src/build/transifex-pull.sh b/src/build/transifex-pull.sh new file mode 100755 index 000000000..0ea8d4b82 --- /dev/null +++ b/src/build/transifex-pull.sh @@ -0,0 +1,92 @@ +#!/bin/bash + +# bash script to update and normalize +# pulled transifex properties files +# +# Author: Tobias Fischer (https://github.com/tofi86) +# Project: IDPF/EpubCheck (https://github.com/IDPF/epubcheck) +# +# Date: 2015-10-09 +# License: MIT License +# + +param1=$1 + + +function escapeISO88591() { + file=$1 + echo "- Escaping ISO-8859-1 encodings with Unicode escapes" + native2ascii -encoding ISO-8859-1 ${file} ${file} +} + +function removeJavaEscapes() { + file=$1 + + # replace \\ -> \, \` -> `, \= -> =, \: -> :, \! -> ! + sed -E -i -- 's/\\([\\`=:!])/\1/g' ${file} + + # make unicode escapes \u00fc uppercase \u00FC + perl -i -pe 's/\\u([0-9a-f]{4})/\\u\U\1/g' ${file} + + # replace newlines in help_text + sed -E -i -- '/^help_text/s/((\\n)+)/\1\\\'$'\n /g' ${file} + sed -E -i -- 's/^( )([[:space:]]+)/\1\\\2/g' ${file} + + # remove temp file + rm ${file}-- 2> /dev/null +} + +function processFile() { + file=$1 + + echo "" + echo "Processing file '${file}'" + file ${file} | grep 'ISO-8859' > /dev/null + if [ $? -eq 0 ]; then + escapeISO88591 ${file} + fi + + removeJavaEscapes ${file} +} + + +# Check if this is running from repo root dir near the .tx/ folder +if [ ! -d .tx/ ] ; then + echo "FATAL: You need to run this script from the repository's root directory!" + echo "e.g. ./src/build/transifex-pull.sh --all" + exit 1 +fi + + +# Check for Transifex Commandline Client +if [ `which tx >/dev/null ; echo $?` -eq 1 ] ; then + echo "FATAL: You need to install the Transifex Commandline Client first in order to run this script!" + echo "Instructions: http://docs.transifex.com/client/setup/" + exit 1 +fi + + +# Show help if no language parameter is passed to the script or --help +if [[ -z ${param1} || ${param1} == "--help" ]] ; then + echo "usage: transifex-pull.sh [--all | <2-digit-country-code>]" + echo "examples:" + echo " transifex-pull.sh --all" + echo " transifex-pull.sh de" + +# Pull ALL translations +elif [ ${param1} == "--all" ] ; then + minimum_percent_translated=$(awk -F "=" '/minimum_perc/ {print $2}' .tx/config) + echo "Pulling ALL epubcheck translations (>${minimum_percent_translated}% done) from Transifex..." + echo "" + tx pull -f | tee /dev/stderr | grep "> [a-z][a-z]: " | awk '{print $3}' | while read f; do processFile ${f}; done + +# Pull translations for a 2-digit-language-code +elif [ ${#param1} -eq 2 ] ; then + echo "Pulling epubcheck translation '${param1}' from Transifex..." + echo "" + tx pull -f -l ${param1} | tee /dev/stderr | grep "${param1}: " | awk '{print $3}' | while read f; do processFile ${f}; done + +else + echo "FATAL: Couldn't recognize language code '${param1}'. Exit." + exit 1 +fi