Ticket #7162: bitsinfo-localization.patch

File bitsinfo-localization.patch, 5.9 KB (added by Karvjorm, 13 years ago)

A bitsinfo localization patch

  • src/tools/translation/bitsinfo/Jamfile

     
    11SubDir HAIKU_TOP src tools translation bitsinfo ;
    22
    3 BinCommand bitsinfo : bitsinfo.cpp : be $(TARGET_LIBSUPC++) ;
     3SetSubDirSupportedPlatformsBeOSCompatible ;
    44
     5BinCommand bitsinfo :
     6    bitsinfo.cpp
     7    : be libbe.so $(HAIKU_LOCALE_LIBS) translation $(TARGET_LIBSTDC++) $(TARGET_LIBSUPC++) ;
     8
     9AddResources bitsinfo : bitsinfo.rdef ;
     10
     11DoCatalogs bitsinfo :
     12    x-vnd.Haiku-bitsinfo
     13    :
     14    bitsinfo.cpp
     15;
  • src/tools/translation/bitsinfo/bitsinfo.rdef

     
     1/*
     2 * bitsinfo.rdef
     3 */
     4
     5resource app_signature "application/x-vnd.Haiku-bitsinfo";
     6
     7resource app_version {
     8    major  = 1,
     9    middle = 0,
     10    minor  = 0,
     11    variety = 0,
     12    internal = 0,
     13    short_info = "bitsinfo displays text information about Be bitmap format ("bits") images.",
     14    long_info = "Haiku bitsinfo is a command line tool for displaying text information about Be bitmap format ("bits") images. Written by Michael Wilber, OBOS Translation Kit Team, Copyright © 2003 OpenBeOS Project."
     15};
     16
     17resource app_flags B_SINGLE_LAUNCH;
  • src/tools/translation/bitsinfo/bitsinfo.cpp

     
    3838#include <stdlib.h>
    3939#include <string.h>
    4040#include <ByteOrder.h>
     41#include <Catalog.h>
    4142#include <File.h>
    4243#include <TranslatorFormats.h>
    4344#include <StorageDefs.h>
    4445
     46#undef B_TRANSLATE_CONTEXT
     47#define B_TRANSLATE_CONTEXT "bitsinfo"
     48
    4549struct ColorSpaceName {
    4650    color_space id;
    4751    const char *name;
     
    6266        // read in the rest of the header
    6367        ssize_t size = sizeof(TranslatorBitmap);
    6468        if (file.Read(reinterpret_cast<uint8 *> (&header), size) != size) {
    65             printf("\nError: Unable to read the Be bitmap header.\n");
     69            printf(B_TRANSLATE("\nError: Unable to read the Be bitmap "
     70                "header.\n"));
    6671            return;
    6772        }
    6873        if (!bdumppixels)
     
    7277        // convert to host byte order
    7378        if (swap_data(B_UINT32_TYPE, &header, sizeof(TranslatorBitmap),
    7479            B_SWAP_BENDIAN_TO_HOST) != B_OK) {
    75             printf("\nError: Unable to swap byte order\n");
     80            printf(B_TRANSLATE("\nError: Unable to swap byte order\n"));
    7681            return;
    7782        }
    7883       
    79         printf("\nBe bitmap (\"bits\") header for: %s\n\n", filepath);
     84        printf(B_TRANSLATE("\nBe bitmap (\"bits\") header for: %s\n\n"),
     85            filepath);
    8086   
    8187        const uint32 kbitsmagic = 0x62697473UL;
    8288            // in ASCII, this number looks like "bits"
    83         printf("magic number: 0x%.8lx ", header.magic);
    8489        if (header.magic == kbitsmagic)
    85             printf("(valid)\n");
     90            printf(B_TRANSLATE("magic number: 0x%.8lx (valid)\n"),
     91                header.magic);
    8692        else
    87             printf("(INVALID, should be: 0x%.8lx)\n",
    88                 kbitsmagic);
    89         printf("bounds: (%f, %f, %f, %f)\n",
     93            printf(B_TRANSLATE("magic number: 0x%.8lx (INVALID, should be: "
     94                "0x%.8lx)\n"), header.magic, kbitsmagic);
     95        printf(B_TRANSLATE("bounds: (%f, %f, %f, %f)\n"),
    9096            header.bounds.left, header.bounds.top,
    9197            header.bounds.right, header.bounds.bottom);
    92         printf("dimensions: %d x %d\n",
     98        printf(B_TRANSLATE("dimensions: %d x %d\n"),
    9399            static_cast<int>(header.bounds.Width() + 1),
    94100            static_cast<int>(header.bounds.Height() + 1));
    95101       
    96         printf("bytes per row: %u\n",
     102        printf(B_TRANSLATE("bytes per row: %u\n"),
    97103            static_cast<unsigned int>(header.rowBytes));
    98104   
    99105        // print out colorspace if it matches an item in the list
     
    149155        int32 i;
    150156        for (i = 0; i < kncolorspaces; i++) {
    151157            if (header.colors == colorspaces[i].id) {
    152                 printf("color space: %s\n", colorspaces[i].name);
     158                printf(B_TRANSLATE("color space: %s\n"), colorspaces[i].name);
    153159                break;
    154160            }
    155161        }
    156162        if (i == kncolorspaces)
    157             printf("color space: Unknown (0x%.8lx)\n",
     163            printf(B_TRANSLATE("color space: Unknown (0x%.8lx)\n"),
    158164                static_cast<unsigned long>(header.colors));
    159165           
    160         printf("data size: %u\n",
     166        printf(B_TRANSLATE("data size: %u\n"),
    161167            static_cast<unsigned int>(header.dataSize));
    162168           
    163169        if (bdumppixels) {
     
    178184                    break;
    179185               
    180186                default:
    181                     printf("Sorry, %s isn't supported yet"
    182                         " for this color space\n", kpixels);
     187                    printf(B_TRANSLATE("Sorry, %s isn't supported yet"
     188                        " for this color space\n"), kpixels);
    183189                    return;
    184190            }
    185191            uint8 *prow = new uint8[header.rowBytes];
    186192            if (!prow) {
    187                 printf("Error: Not enough memory for row buffer\n");
     193                printf(B_TRANSLATE("Error: Not enough memory for row "
     194                    "buffer\n"));
    188195                return;
    189196            }
    190197            ssize_t ret, n;
    191198            uint32 totalbytes = 0;
    192             printf("pixel data (%s):\n", components);
     199            printf(B_TRANSLATE("pixel data (%s):\n"), components);
    193200            while ((ret = file.Read(prow, header.rowBytes)) > 0) {
    194201                n = 0;
    195202                while (n < ret) {
     
    205212        }           
    206213       
    207214    } else
    208         printf("Error opening %s\n", filepath);
     215        printf(B_TRANSLATE_COMMENT("Error opening %s\n",
     216            "file path is opening"), filepath);
    209217}
    210218
    211219int
    212220main(int argc, char **argv)
    213221{
    214222    if (argc == 1) {
    215         printf("\nbitsinfo - reports information about a Be bitmap (\"bits\") image\n");
    216         printf("\nUsage:\n");
    217         printf("bitsinfo [options] filename.bits\n\n");
    218         printf("Options:\n\n");
    219         printf("\t%s \t print RGB color for each pixel\n", kpixels);
     223        printf(B_TRANSLATE("\nbitsinfo - reports information about a Be "
     224            "bitmap (\"bits\") image\n"));
     225        printf(B_TRANSLATE("\nUsage:\n"));
     226        printf(B_TRANSLATE("bitsinfo [options] filename.bits\n\n"));
     227        printf(B_TRANSLATE("Options:\n\n"));
     228        printf(B_TRANSLATE("\t%s \t print RGB color for each pixel\n"),
     229            kpixels);
    220230    }
    221231    else {
    222232        int32 first = 1;