Opened 13 years ago

Closed 12 years ago

#7873 closed bug (fixed)

B_TRANSLATE("String") between #ifdef and #endif not included in catalogs

Reported by: taos Owned by: zooey
Priority: normal Milestone: R1
Component: - General Version: R1/Development
Keywords: localization, HTA Cc:
Blocked By: Blocking:
Platform: All

Description

Strings that are prepared for translation by using the translation macros (e.g. B_TRANSLATTE("String")) don't appear on HTA if they are part of #if USE_SSL ... #endif statements.

Example (/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp):

{
#ifdef USE_SSL
	AddFlavor(B_TRANSLATE("Unencrypted"));
	AddFlavor(B_TRANSLATE("SSL"));
	AddFlavor(B_TRANSLATE("STARTTLS"));
#endif

	AddAuthMethod(B_TRANSLATE("None"), false);
	AddAuthMethod(B_TRANSLATE("ESMTP"));
	AddAuthMethod(B_TRANSLATE("POP3 before SMTP"), false);

[...]
	}

"None", "ESMTP", and "POP3 before SMTP" are included in the respective catalog files (e.g. sk.catkeys) whereas "Unencrypted", "SSL", and "STARTTLS" are missing from HTA.

Attachments (1)

BeMenu.png (60.3 KB ) - added by taos 13 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 by taos, 13 years ago

Summary: B_TRANSLATE("String") between #if USE_SSL and #endif not included in catalogsB_TRANSLATE("String") between #ifdef and #endif not included in catalogs

More examples can be found in /src/apps/deskbar/BeMenu.cpp:

#ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL
	static const char* kAboutHaikuMenuItemStr = B_TRANSLATE_MARK(
		"About Haiku");
#else
	static const char* kAboutThisSystemMenuItemStr = B_TRANSLATE_MARK(
		"About this system");
#endif
#ifdef APM_SUPPORT
	static const char* kSuspendMenuItemStr = B_TRANSLATE_MARK("Suspend");

	if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) {
		item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kSuspendMenuItemStr),
			new BMessage(kSuspendSystem));
		item->SetEnabled(!dragging);
		shutdownMenu->AddItem(item);
	}
#endif

From HTA (and thus from corresponding catkeys and catalog files), "About Haiku" and "Suspend" are missing. If building an image with --distro-compatibility official you'll get a Be Menu entry that's not translated:

Last edited 13 years ago by taos (previous) (diff)

by taos, 13 years ago

Attachment: BeMenu.png added

comment:2 by pulkomandy, 13 years ago

Owner: changed from nobody to pulkomandy
Status: newassigned

The solution is likely to use B_TRANSLATE_MARK outside the ifdef to mark the strings anyway (so collectcatkeys can find them).

comment:3 by pulkomandy, 13 years ago

Fixed in hrev42991. Please tell if you find other instances of it.

comment:4 by pulkomandy, 13 years ago

Resolution: fixed
Status: assignedclosed

comment:5 by taos, 13 years ago

Resolution: fixed
Status: closedreopened

Problem is back since update of catkeys from pootle in hrev44109. I suppose the culprit can be found after hrev44023 (previous translation update from pootle) - maybe due to changes in BCatalog?

comment:6 by pulkomandy, 12 years ago

BCatalog shouldn't be involved. The problem may be hat B_TRANSLATE_MARK macro doesn't work anymore, or maybe the preprocessor optimizing it away somehow.

The problem is http://cgit.haiku-os.org/haiku/commit/?id=541ff51a6ef4c47f8ab105ba6ff895cdbba83aca , the B_TRANSLATE macros changed meaning and this part of the code was not adjusted.

Are there other places besides Mail add-on SSL and BeMenu ?

comment:7 by pulkomandy, 12 years ago

Resolution: fixed
Status: reopenedclosed

Well, fixeed these two in hrev44205. Tell us if you see more.

comment:8 by zooey, 12 years ago

Resolution: fixed
Status: closedreopened

Thanks for cleaning up after me.

However, I think the fix indicates that switching back to using B_COLLECTING_CATKEYS when collecting the catalog keys is a good idea. With that macro, it wouldn't be necessary to give each string twice (once for marking and once for creating the menu item).

Reopening and taking the ticket, so I won't forget ...

comment:9 by zooey, 12 years ago

Owner: changed from pulkomandy to zooey
Status: reopenedassigned

comment:10 by pulkomandy, 12 years ago

Well, actually it's possible to revert to the scheme used before introduction of B_COLLECTING_CATKEYS :

static const char* kSomeString = B_TRANSLATE_MARK("Some String");

#ifdef FOO
// ...
new BMenuItem(B_TRANSLATE_NOCOLLECT(kSomeString));
// ...
#endif

The problem with this is the string could end up in the binary (didn't check if it actually happens)

So yes, having B_COLLECTING_CATKEYS around might still be helpful. It could be added in the jam rule as a preprocessor option, if we don't want it in an header.

comment:11 by zooey, 12 years ago

Resolution: fixed
Status: assignedclosed

Fixed in hrev44546, B_COLLECTING_CATKEYS is now back again.

Note: See TracTickets for help on using tickets.