Author: hbelusca
Date: Thu Jun 9 19:01:47 2016
New Revision: 71600
URL:
http://svn.reactos.org/svn/reactos?rev=71600&view=rev
Log:
[COMP]
- Localize comp.exe. Patch + romanian translation by Stefan Fulea.
- French translation by Hermès Bélusca.
CORE-11060
Added:
trunk/reactos/base/applications/cmdutils/comp/lang/
trunk/reactos/base/applications/cmdutils/comp/lang/en-US.rc (with props)
trunk/reactos/base/applications/cmdutils/comp/lang/fr-FR.rc (with props)
trunk/reactos/base/applications/cmdutils/comp/lang/ro-RO.rc (with props)
trunk/reactos/base/applications/cmdutils/comp/resource.h (with props)
Modified:
trunk/reactos/base/applications/cmdutils/comp/CMakeLists.txt
trunk/reactos/base/applications/cmdutils/comp/comp.c
trunk/reactos/base/applications/cmdutils/comp/comp.rc
Modified: trunk/reactos/base/applications/cmdutils/comp/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/comp/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/base/applications/cmdutils/comp/CMakeLists.txt [iso-8859-1] Thu Jun 9
19:01:47 2016
@@ -1,5 +1,5 @@
add_executable(comp comp.c comp.rc)
-set_module_type(comp win32cui)
-add_importlibs(comp msvcrt kernel32)
+set_module_type(comp win32cui UNICODE)
+add_importlibs(comp user32 msvcrt kernel32)
add_cd_file(TARGET comp DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/base/applications/cmdutils/comp/comp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/comp/comp.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/cmdutils/comp/comp.c [iso-8859-1] Thu Jun 9 19:01:47
2016
@@ -31,7 +31,28 @@
#include <string.h>
#include <assert.h>
+#include "resource.h"
+
#define STRBUF 1024
+
+VOID ResPrint(INT res_no, ...)
+{
+ TCHAR * res_string;
+ va_list vargs;
+
+ va_start(vargs, res_no);
+
+ if (LoadString(GetModuleHandle(NULL), res_no, (TCHAR*)&res_string, 0))
+ {
+ _vtprintf(res_string, vargs);
+ }
+ else
+ {
+ _tprintf(_T("Resource loading error!"));
+ }
+
+ va_end(vargs);
+}
/* getline: read a line, return length */
INT GetBuff(PBYTE buff, FILE *in)
@@ -53,12 +74,7 @@
/* Print program usage */
VOID Usage(VOID)
{
- _tprintf(_T("\nCompares the contents of two files or sets of files.\n\n"
- "COMP [/L] [/A] [data1] [data2]\n\n"
- " data1 Specifies location and name of first file to
compare.\n"
- " data2 Specifies location and name of second file to
compare.\n"
- " /A Display differences in ASCII characters.\n"
- " /L Display line numbers for differences.\n"));
+ ResPrint(IDS_HELP);
}
@@ -88,26 +104,26 @@
/* Parse command line for options */
for (i = 1; i < argc; i++)
{
- if (argv[i][0] == '/')
+ if (argv[i][0] == _T('/'))
{
switch (argv[i][1])
{
- case 'A':
+ case _T('A'):
bAscii = TRUE;
NumberOfOptions++;
break;
- case 'L':
+ case _T('L'):
bLineNos = TRUE;
NumberOfOptions++;
break;
- case '?':
+ case _T('?'):
Usage();
return EXIT_SUCCESS;
default:
- _tprintf(_T("Invalid switch - /%c\n"), argv[i][1]);
+ ResPrint(IDS_INVALIDSWITCH, argv[i][1]);
Usage();
return EXIT_FAILURE;
}
@@ -121,7 +137,7 @@
}
else
{
- _tprintf(_T("Bad command line syntax\n"));
+ ResPrint(IDS_BADSYNTAX);
return EXIT_FAILURE;
}
@@ -141,26 +157,26 @@
goto Cleanup;
}
- if ((fp1 = fopen(File1, "rb")) == NULL)
- {
- _tprintf(_T("Can't find/open file: %s\n"), File1);
- Status = EXIT_FAILURE;
- goto Cleanup;
- }
- if ((fp2 = fopen(File2, "rb")) == NULL)
- {
- _tprintf(_T("Can't find/open file: %s\n"), File2);
- Status = EXIT_FAILURE;
- goto Cleanup;
- }
-
-
- _tprintf(_T("Comparing %s and %s...\n"), File1, File2);
+ if ((fp1 = _tfopen(File1, _T("rb"))) == NULL)
+ {
+ ResPrint(IDS_FILEERROR, File1);
+ Status = EXIT_FAILURE;
+ goto Cleanup;
+ }
+ if ((fp2 = _tfopen(File2, _T("rb"))) == NULL)
+ {
+ ResPrint(IDS_FILEERROR, File2);
+ Status = EXIT_FAILURE;
+ goto Cleanup;
+ }
+
+
+ ResPrint(IDS_COMPARING, File1, File2);
FileSizeFile1 = FileSize(fp1);
if (FileSizeFile1 == -1)
{
- _tprintf(_T("Can't determine size of file: %s\n"), File1);
+ ResPrint(IDS_FILESIZEERROR, File1);
Status = EXIT_FAILURE;
goto Cleanup;
}
@@ -168,14 +184,14 @@
FileSizeFile2 = FileSize(fp2);
if (FileSizeFile2 == -1)
{
- _tprintf(_T("Can't determine size of file: %s\n"), File2);
+ ResPrint(IDS_FILESIZEERROR, File2);
Status = EXIT_FAILURE;
goto Cleanup;
}
if (FileSizeFile1 != FileSizeFile2)
{
- _tprintf(_T("Files are different sizes.\n"));
+ ResPrint(IDS_SIZEDIFFERS);
Status = EXIT_FAILURE;
goto Cleanup;
}
@@ -189,7 +205,7 @@
if (ferror(fp1) || ferror(fp2))
{
- _tprintf(_T("Files read error.\n"));
+ ResPrint(IDS_READERROR);
Status = EXIT_FAILURE;
goto Cleanup;
}
@@ -207,22 +223,22 @@
/* Reporting here a mismatch */
if (bLineNos)
{
- _tprintf(_T("Compare error at LINE %d\n"), LineNumber);
+ ResPrint(IDS_MISMATCHLINE, LineNumber);
}
else
{
- _tprintf(_T("Compare error at OFFSET %d\n"), Offset);
+ ResPrint(IDS_MISMATCHOFFSET, Offset);
}
if (bAscii)
{
- _tprintf(_T("file1 = %c\n"), Buff1[i]);
- _tprintf(_T("file2 = %c\n"), Buff2[i]);
+ ResPrint(IDS_ASCIIDIFF, 1, Buff1[i]);
+ ResPrint(IDS_ASCIIDIFF, 2, Buff2[i]);
}
else
{
- _tprintf(_T("file1 = %X\n"), Buff1[i]);
- _tprintf(_T("file2 = %X\n"), Buff2[i]);
+ ResPrint(IDS_HEXADECIMALDIFF, 1, Buff1[i]);
+ ResPrint(IDS_HEXADECIMALDIFF, 2, Buff2[i]);
}
Offset++;
@@ -234,7 +250,7 @@
}
if (FilesOK)
- _tprintf(_T("Files compare OK\n"));
+ ResPrint(IDS_MATCH);
Cleanup:
if (fp2)
Modified: trunk/reactos/base/applications/cmdutils/comp/comp.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/comp/comp.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/cmdutils/comp/comp.rc [iso-8859-1] Thu Jun 9 19:01:47
2016
@@ -1,5 +1,23 @@
+#include <windef.h>
+
+#include "resource.h"
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#define REACTOS_STR_FILE_DESCRIPTION "File Compare Utility"
#define REACTOS_STR_INTERNAL_NAME "comp"
#define REACTOS_STR_ORIGINAL_FILENAME "comp.exe"
#include <reactos/version.rc>
+
+/* UTF-8 */
+#pragma code_page(65001)
+
+#ifdef LANGUAGE_EN_US
+ #include "lang/en-US.rc"
+#endif
+#ifdef LANGUAGE_FR_FR
+ #include "lang/fr-FR.rc"
+#endif
+#ifdef LANGUAGE_RO_RO
+ #include "lang/ro-RO.rc"
+#endif
Added: trunk/reactos/base/applications/cmdutils/comp/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/comp/lang/en-US.rc (added)
+++ trunk/reactos/base/applications/cmdutils/comp/lang/en-US.rc [iso-8859-1] Thu Jun 9
19:01:47 2016
@@ -0,0 +1,23 @@
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+STRINGTABLE
+BEGIN
+ IDS_HELP "Compares the contents of two files or sets of files.\n\n\
+COMP [/L] [/A] [data1] [data2]\n\n\
+ data1 Specifies location and name of first file to compare.\n\
+ data2 Specifies location and name of second file to compare.\n\
+ /A Display differences in ASCII characters (default: hexadecimal).\n\
+ /L Display line numbers for differences.\n"
+ IDS_INVALIDSWITCH "Invalid switch - /%c\n"
+ IDS_BADSYNTAX "Bad command line syntax\n"
+ IDS_FILEERROR "Cannot find/open file: %s\n"
+ IDS_COMPARING "Comparing %s and %s...\n"
+ IDS_FILESIZEERROR "Cannot determine size of file: %s\n"
+ IDS_SIZEDIFFERS "Files are different sizes.\n"
+ IDS_READERROR "Files read error.\n"
+ IDS_MISMATCHLINE "Compare error at LINE %d\n"
+ IDS_MISMATCHOFFSET "Compare error at OFFSET 0x%X\n"
+ IDS_ASCIIDIFF "file%d = %c\n"
+ IDS_HEXADECIMALDIFF "file%d = %X\n"
+ IDS_MATCH "Files compare OK\n"
+END
Propchange: trunk/reactos/base/applications/cmdutils/comp/lang/en-US.rc
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/base/applications/cmdutils/comp/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/comp/lang/fr-FR.rc (added)
+++ trunk/reactos/base/applications/cmdutils/comp/lang/fr-FR.rc [iso-8859-1] Thu Jun 9
19:01:47 2016
@@ -0,0 +1,23 @@
+LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
+
+STRINGTABLE
+BEGIN
+ IDS_HELP "Compare le contenu de deux fichiers ou ensembles de fichiers.\n\n\
+COMP [/L] [/A] [data1] [data2]\n\n\
+ data1 Spécifie l'emplacement et le nom du premier fichier à comparer.\n\
+ data2 Spécifie l'emplacement et le nom du second fichier à comparer.\n\
+ /A Affiche les différences en caractères ASCII (défaut: hexadécimal).\n\
+ /L Affiche les numéros de ligne des différences.\n"
+ IDS_INVALIDSWITCH "Paramètre invalide - /%c\n"
+ IDS_BADSYNTAX "Syntaxe incorrecte\n"
+ IDS_FILEERROR "Impossible de trouver/ouvrir le fichier : %s\n"
+ IDS_COMPARING "Comparaison de %s et %s...\n"
+ IDS_FILESIZEERROR "Ne peut pas déterminer la taille du fichier : %s\n"
+ IDS_SIZEDIFFERS "Les fichiers sont de taille différente.\n"
+ IDS_READERROR "Erreur lors de la lecture des fichiers.\n"
+ IDS_MISMATCHLINE "Erreur de comparaison à LIGNE %d\n"
+ IDS_MISMATCHOFFSET "Erreur de comparaison à OFFSET 0x%X\n"
+ IDS_ASCIIDIFF "fichier%d = %c\n"
+ IDS_HEXADECIMALDIFF "fichier%d = %X\n"
+ IDS_MATCH "Comparaison des fichiers OK\n"
+END
Propchange: trunk/reactos/base/applications/cmdutils/comp/lang/fr-FR.rc
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/base/applications/cmdutils/comp/lang/ro-RO.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/comp/lang/ro-RO.rc (added)
+++ trunk/reactos/base/applications/cmdutils/comp/lang/ro-RO.rc [iso-8859-1] Thu Jun 9
19:01:47 2016
@@ -0,0 +1,24 @@
+/* Ètefan Fulea (stefan dot fulea at mail dot md) */
+LANGUAGE LANG_ROMANIAN, SUBLANG_DEFAULT
+
+STRINGTABLE
+BEGIN
+ IDS_HELP "ComparÄ conÈinuturile a douÄ fiÈiere sau grupuri de
fiÈiere.\n\n\
+COMP [/L] [/A] [data1] [data2]\n\n\
+ data1 Calea Èi numele primului fiÈier de comparat.\n\
+ data2 Calea Èi numele celui de-al doilea fiÈier de comparat.\n\
+ /A AfiÈeazÄ diferenÈele în caractere ASCII (default: hexadecimal).\n\
+ /L AfiÈeazÄ numÄrul liniei pentru diferenÈe.\n"
+ IDS_INVALIDSWITCH "Parametru nevalid - /%c\n"
+ IDS_BADSYNTAX "SintaxÄ eronatÄ\n"
+ IDS_FILEERROR "Nu se poate gÄsi/deschide fiÈierul: %s\n"
+ IDS_COMPARING "Se comparÄ %s Èi %s...\n"
+ IDS_FILESIZEERROR "Nu se poate determina dimensiunea fiÈierului: %s\n"
+ IDS_SIZEDIFFERS "FiÈierele au dimensiuni diferite.\n"
+ IDS_READERROR "Eroare la citirea fiÈierelor.\n"
+ IDS_MISMATCHLINE "DiferenÈÄ identificatÄ la linia %d\n"
+ IDS_MISMATCHOFFSET "DiferenÈÄ identificatÄ la poziÈia 0x%X\n"
+ IDS_ASCIIDIFF "fiÈier%d = %c\n"
+ IDS_HEXADECIMALDIFF "fiÈier%d = %X\n"
+ IDS_MATCH "FiÈierele sunt identice\n"
+END
Propchange: trunk/reactos/base/applications/cmdutils/comp/lang/ro-RO.rc
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/base/applications/cmdutils/comp/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/comp/resource.h (added)
+++ trunk/reactos/base/applications/cmdutils/comp/resource.h [iso-8859-1] Thu Jun 9
19:01:47 2016
@@ -0,0 +1,15 @@
+#pragma once
+
+#define IDS_HELP 100
+#define IDS_INVALIDSWITCH 101
+#define IDS_BADSYNTAX 102
+#define IDS_FILEERROR 103
+#define IDS_COMPARING 104
+#define IDS_FILESIZEERROR 105
+#define IDS_SIZEDIFFERS 106
+#define IDS_READERROR 107
+#define IDS_MISMATCHLINE 108
+#define IDS_MISMATCHOFFSET 109
+#define IDS_ASCIIDIFF 110
+#define IDS_HEXADECIMALDIFF 111
+#define IDS_MATCH 112
Propchange: trunk/reactos/base/applications/cmdutils/comp/resource.h
------------------------------------------------------------------------------
svn:eol-style = native