diff --git a/ChangeLog.txt b/ChangeLog.txt index 29eab48a26..386ce743cf 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,13 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-04-01 05:35 UTC+0200 Viktor Szakats (harbour syenar.net) + * utils/hbmk2/lang.hb + + more automatic doctoring of translated strings + + * utils/hbmk2/hbmk2.prg + * added TOFIX for an ambiguous translatable string + 2013-04-01 04:21 UTC+0200 Viktor Szakats (harbour syenar.net) * utils/hbmk2/hbmk2.prg ! few value names were translatable by mistake diff --git a/utils/hbmk2/hbmk2.prg b/utils/hbmk2/hbmk2.prg index 5b8b2abbeb..60f0dc738f 100644 --- a/utils/hbmk2/hbmk2.prg +++ b/utils/hbmk2/hbmk2.prg @@ -16331,6 +16331,7 @@ STATIC PROCEDURE ShowHelp( hbmk, lMore, lLong ) hb_StrFormat( I_( "GNU Make or any C compiler specific make tool and MSYS " + ; "(on Windows) are not needed to run %1$s." ), _SELF_NAME_ ), ; I_( ". (dot) passed as first parameter will enter the interactive Harbour shell." ) } + /* TOFIX: ". (dot)" -> "'.' (dot)" */ LOCAL aLst_Notes_Shell := { ; NIL, ; diff --git a/utils/hbmk2/lang.hb b/utils/hbmk2/lang.hb index 3d83836d40..ce551ed563 100644 --- a/utils/hbmk2/lang.hb +++ b/utils/hbmk2/lang.hb @@ -1,12 +1,30 @@ /* - * Manages translations and automatic doc generation + * Harbour Project source code: + * Manage translations and automatic doc generation * * Copyright 2013 Viktor Szakats (harbour syenar.net) * www - http://harbour-project.org * - * Requires: curl (built with SSL), Harbour in PATH - * Reference: http://help.transifex.com/features/api/api-v2.1.html + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + * their web site at http://www.gnu.org/). + * + */ + +/* + * Requires: curl (built with SSL) and Harbour in PATH + * Reference: http://help.transifex.com/features/api/api-v2.1.html */ #pragma -w3 @@ -209,13 +227,42 @@ STATIC PROCEDURE trs_pull( cLogin ) RETURN -STATIC FUNCTION DoctorTranslation( cString ) +STATIC FUNCTION DoctorTranslation( cString, cOri ) - cString := StrUnspace( AllTrim( cString ) ) + LOCAL regex, hit + + cString := AllTrim( cString ) + + /* Only if original doesn't have elongated spaces */ + IF cOri == StrUnspace( cOri ) + cString := StrUnspace( cString ) + ENDIF + + /* For Transifex: RETURN SYMBOL to real new line */ cString := StrTran( cString, hb_UChar( 0x23CE ), e"\n" ) - cString := StrTran( cString, e"\n ", e"\n" ) - cString := StrTran( cString, "( ", "(" ) - cString := StrTran( cString, " )", ")" ) + + /* Common typos: extra space or punctuation */ + cString := hb_StrReplace( cString, { ; + e"\n " => e"\n" , ; + e" .\n" => e".\n" , ; + "( " => "(" , ; + " )" => ")" , ; + " :" => ":" , ; + " ," => "," , ; + " ;" => ";" , ; + ":. " => ": " , ; + ": . " => ": " , ; + ":, " => ": " , ; + ": , " => ": " } ) + + /* Common typos: missing space */ + FOR EACH regex IN { ":([A-Za-z])", "[,;](\S)", "\)(\w)" } + FOR EACH hit IN hb_regexAll( regex, cString,,,,, .T. ) + IF ! hit[ 1 ] $ cOri + cString := StrTran( cString, hit[ 1 ], StrTran( hit[ 1 ], hit[ 2 ], " " + hit[ 2 ] ) ) + ENDIF + NEXT + NEXT RETURN cString