Opened 10 years ago

Closed 10 years ago

#5017 closed enhancement (fixed)

[Patch] Virtualmemory preflet localization

Reported by: mt Owned by: pulkomandy
Priority: normal Milestone: R1
Component: Preferences/VirtualMemory Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

Layout system + Localization patch and sample catkeys for Virtualmemory preflet.
Problem:
SizeSlider::UpdateText() can't draw correctly when SettingsWindow first appears. (When no catalog file in /boot/system/data/locale/catalogs/x-vnd.Haiku-VirtualMemory, it can draw correctly.)

Attachments (2)

VirtualMemory.patch (11.1 KB ) - added by mt 10 years ago.
patch file
en.catkeys (1.4 KB ) - added by mt 10 years ago.
sample catkey file

Download all attachments as: .zip

Change History (7)

by mt, 10 years ago

Attachment: VirtualMemory.patch added

patch file

by mt, 10 years ago

Attachment: en.catkeys added

sample catkey file

comment:1 by stippi, 10 years ago

Hi mt! The patch looks good except for the following issues:

In the function byte_size(), you should not modify the static const char units line at all. You already added the TR marco to where the static strings are used. And this asks the question whether it should be the TR_MARK macro there instead.

I don't have much experience with translation requirements, but I believe I have heard that it's better to leave string compositing to the translation process. So instead of

BString string(TR("Physical Memory: "));
string << memory << TR(label);

you would use some form of compositing method which BLocal perhaps provides. ("Phsyical Memory: %1%2", bytes, label). Some translation could then change the order of strings in the composition, if you know what I mean.

Thanks a lot for the patch! You could leave the second problem to someone else if you want, or I can apply your patch fixing the first issue I pointed out. Just tell me.

comment:2 by stippi, 10 years ago

Owner: changed from axeld to stippi
Status: newassigned

in reply to:  1 comment:3 by mt, 10 years ago

Replying to stippi:
Thanks stippi for checking patch.

Hi mt! The patch looks good except for the following issues:

In the function byte_size(), you should not modify the static const char units line at all. You already added the TR marco to where the static strings are used. And this asks the question whether it should be the TR_MARK macro there instead.

In my build environment (both haiku and Ubuntu9.10), this message does not appear and preflet can build successfully.

I don't have much experience with translation requirements, but I believe I have heard that it's better to leave string compositing to the translation process. So instead of

BString string(TR("Physical Memory: "));
string << memory << TR(label);

you would use some form of compositing method which BLocal perhaps provides. ("Phsyical Memory: %1%2", bytes, label). Some translation could then change the order of strings in the composition, if you know what I mean.

Though I do not know BLocal in detail, I think BLocal dose not use catalog file. I want to write like this in future (TR_FMT is macro or function);

BString string(TR_FMT("Phsyical Memory: %s%s", bytes, label));

Thanks a lot for the patch! You could leave the second problem to someone else if you want, or I can apply your patch fixing the first issue I pointed out. Just tell me.

First issue is not reproduced in my environment, please fix it. and I want to leave second problem to someone.

comment:4 by pulkomandy, 10 years ago

Owner: changed from stippi to pulkomandy
Status: in-progressassigned

The patch looks fine for me, TR_MARK is used to translate the static. It doesn't do anything on the code size, but it marks the strings so they end up in the catalog.

As for the string compositing, the simplest way is to use positional markers in the % escapes. Like this : TR("Physical Memory: %1$s%2$s"), bytes, label. This means "take arg 1 (bytes) firs, and arg 2 next to it. If the translator wants to get the reverse way, he translates the string with "Physical Memory: %2$s%1$s". Your code is technically perfectly fine but less useable for translators in some languages.

comment:5 by pulkomandy, 10 years ago

Resolution: fixed
Status: assignedclosed

Patch applied in hrev35007

Note: See TracTickets for help on using tickets.