Opened 14 years ago

Last modified 4 years ago

#5743 assigned bug

Texts in resource file is not localized in Printers preflet

Reported by: Karvjorm Owned by: nobody
Priority: normal Milestone: R1.1
Component: Preferences/Printers Version: R1/alpha2
Keywords: localization Cc: Karvjorm
Blocked By: Blocking:
Platform: All

Description

Texts "Preview", "Save as PDF", "PDF Writer" and "Print To File" are not localized in the User Interface of Printers.

Also, the last letter of Save as PDF overrides the first letter of "No pending jobs" text.

I include here also a PrintersUpdate.patch that could fix some problems with the non-localized texts.

Attachments (2)

printersinrevision36263.png (18.9 KB ) - added by Karvjorm 14 years ago.
PrintersUpdate.patch (1.6 KB ) - added by Karvjorm 14 years ago.
An updated patch for Printers localization

Download all attachments as: .zip

Change History (18)

by Karvjorm, 14 years ago

Attachment: printersinrevision36263.png added

comment:1 by laplace, 14 years ago

In its current form the patch is not acceptable:

  1. translating the printer name cannot work that way, because the printer name ("Preview", "PDF Writer") is the file name of the printer driver add-on, "Print To File" is the file name of the print transport add-on, and Haiku at this time does not provide a way to translate file names. "Preview" and "Save as PDF" are names given at the creation time of the printer spool folders. That is at the build time of an Haiku image. At the moment I don't have a solution for that either.
  1. style formatting should not be mixed with functional changes

For the display problem there is already an entry #4263.

by Karvjorm, 14 years ago

Attachment: PrintersUpdate.patch added

An updated patch for Printers localization

comment:3 by Karvjorm, 14 years ago

patch: 01

in reply to:  4 ; comment:5 by laplace, 14 years ago

Replying to Karvjorm:

I don't want to demotivate you, but have you tested the patch at all?

The text you're trying to translate is stored in file attributes, so changing the locale later won't update the text, resulting in an inconsistent state. I would rather leave the text untranslated in English than to use that broken workaround.

Line 100, 405 & 407: I have tried to explain why that won't work in 1.
Line 110: at the moment the "connection" text is not displayed anywhere, and won't be updated when the locale changes as explained above.
Line 190: "Print" is the name of the printer driver add-on folder and must not to be translated.

I would be very grateful if someone would come to a proper solution for the translation problems.

BTW if you want to contribute more the printing related issues, for example have a look a ticket #4178.

comment:6 by laplace, 14 years ago

patch: 10

in reply to:  5 ; comment:7 by Karvjorm, 14 years ago

Replying to laplace:

Replying to Karvjorm:

I don't want to demotivate you, but have you tested the patch at all?

Yes, but I'm not able to do it correct, because application is opened only partly. When Printers application is generated to gererated/objects/.../preferences/print directory, I have linked lib directory with the present generated libraries to a subdirectory for the print directory.

Then I call ./Printers in command line window and Printers open in deskbar below Tracker and Terminal, but without open window (submenu shows only "no window" and "quit application" options).

Problem is, that I have not succeeded to open any other localized application (except src/bin/filepanel) from the version control tree. I do not know, how I should do it.

The text you're trying to translate is stored in file attributes, so changing the locale later won't update the text, resulting in an inconsistent state. I would rather leave the text untranslated in English than to use that broken workaround.

Line 100, 405 & 407: I have tried to explain why that won't work in 1.
Line 110: at the moment the "connection" text is not displayed anywhere, and won't be updated when the locale changes as explained above.
Line 190: "Print" is the name of the printer driver add-on folder and must not to be translated.

I would be very grateful if someone would come to a proper solution for the translation problems.

Then about this "Preview" issue: when I open preferences/print from deskbar, I still will see "Preview" (two times) there. From the source code I can find only those "Preview" texts and they should be localized, I think. If some attribute value (?) is shown there in the view window, then it should be localized, or some other solution should be used there. When comparing strings B_TRANSLATE macro should return the same localized string that is in attribute and the code should then work. That is my logic, but it is obviously wrong?

BTW if you want to contribute more the printing related issues, for example have a look a ticket #4178.

OK, I will check that. Thanks.

in reply to:  5 comment:8 by Karvjorm, 14 years ago

Replying to laplace:

Line 100, 405 & 407: I have tried to explain why that won't work in 1.

OK, now I even read the first comment. Should have read it previously.

in reply to:  7 ; comment:9 by laplace, 14 years ago

Version: R1/alpha1R1/alpha2

Replying to Karvjorm:

I don't want to demotivate you, but have you tested the patch at all?

Yes, but I'm not able to do it correct, because application is opened only partly. When Printers application is generated to gererated/objects/.../preferences/print directory, I have linked lib directory with the present generated libraries to a subdirectory for the print directory.

Then I call ./Printers in command line window and Printers open in deskbar below Tracker and Terminal, but without open window (submenu shows only "no window" and "quit application" options).

Problem is, that I have not succeeded to open any other localized application (except src/bin/filepanel) from the version control tree. I do not know, how I should do it.

Do you use Haiku as the development platform? Maybe it is already too old and there are incompatibilities, when you try to run the applications that you build from the tree?

I have Haiku r1a2 installed and built the Printers preflet from the tree. Opening the UI with ./Printers works (however for an unknown reason the list of printers is not updated when a printer is added or removed; after reopening the Printers preflet the printers are shown however).

Then about this "Preview" issue: when I open preferences/print from deskbar, I still will see "Preview" (two times) there. From the source code I can find only those "Preview" texts and they should be localized, I think. If some attribute value (?) is shown there in the view window, then it should be localized, or some other solution should be used there. When comparing strings B_TRANSLATE macro should return the same localized string that is in attribute and the code should then work. That is my logic, but it is obviously wrong?

What you see in the printer list is for each installed printer:
In the first line:
The name of the printer; and the number of pending print jobs.
In the second line:
The name of the used printer driver; and the name of the used transport add-on.
In the third line:
An optional comment, at the moment that seems always to be empty.

You see "Preview" twice, because the installed "printer" is named "Preview" and it uses to printer driver "Preview".

In Haiku a printer driver is responsible to generate data from a print job that can be understood by a printer. A printer driver uses a transport add-on to to send the data to the printer. Examples for transport add-ons are: USB Port, Parallel Port and "Print To File".

The "Preview" printer driver is the the only exception that does not use a transport add-on (this case is even hard coded in the Printers preflet; that's why you can see the string "Preview" in the source code).

For more information about printer drivers see:
http://www.haiku-os.org/documents/dev/how_to_write_a_printer_driver

For now there are three strings that should be localized:

  • the name of the pre-installed printer ("Preview" and "Save as PDF file")
  • the name of the printer driver
  • the name of the transport add-on

For translation of the name of a pre-installed printer I don't have a good solution other than handling them specially in the Printers preflet (in PrinterItem::DrawItem() and also in the print_server).

The right way to get the localized name of a printer driver or transport add-on would be to ask them. In order to do that a new interface would be required. The add-ons for example should export a C function:

void get_display_name(BString* name);

That should return the localized name of the add-on for the currently selected locale.

You cannot simply translate the printer driver and transport add-on names, because these can be added to the system later too (for example developed by a 3rd party developer), then for these the translations would be missing.

About attribute values used by the print kit:
The information about installed printers is not stored in data files, but in folders and attributes of these folders. Have a look into /boot/home/config/settings/printers. For each installed printer you will find there a folder. The folder name is based on the installed printer name (but can be different in case it contains characters not allowed in a file name). The printer name, used printer driver name, used transport add-on name, and so on are stored in file attributes.

You can use in the Terminal in the mentioned "printers" folder:

listattr Preview

To list the attributes attached to the "Preview" folder. And for example

catattr "Driver Name" Preview

to display the name of the used printer driver.

in reply to:  9 comment:10 by Karvjorm, 14 years ago

Replying to laplace:

Do you use Haiku as the development platform? Maybe it is already too old and there are incompatibilities, when you try to run the applications that you build from the tree?

Yes, I'm running r1alpha2 in VMware player in Windows environment and virtual machine is on USB stick. Version control tree is in /Blank_BFS/haiku and when it is time to move to following nightly-build, I can easily move the whole Blank_BFS to parent directory of USB stick and replace the Blank_BFS of the nightly build after it is installed.

I have Haiku r1a2 installed and built the Printers preflet from the tree. Opening the UI with ./Printers works (however for an unknown reason the list of printers is not updated when a printer is added or removed; after reopening the Printers preflet the printers are shown however).

I did not build Printers preflet before localization changes but maybe I should try it. I have to delete changes files and restore them from version control.

What you see in the printer list is for each installed printer:
In the first line:
The name of the printer; and the number of pending print jobs.
In the second line:
The name of the used printer driver; and the name of the used transport add-on.
In the third line:
An optional comment, at the moment that seems always to be empty.

You see "Preview" twice, because the installed "printer" is named "Preview" and it uses to printer driver "Preview".

OK

In Haiku a printer driver is responsible to generate data from a print job that can be understood by a printer. A printer driver uses a transport add-on to to send the data to the printer. Examples for transport add-ons are: USB Port, Parallel Port and "Print To File".

Yes, I have seen those when I tried to use my Brother MFC-7820N printer. It is connected to USB Port and I tried to define the PS compatible printer or something like it, but without success.

The "Preview" printer driver is the the only exception that does not use a transport add-on (this case is even hard coded in the Printers preflet; that's why you can see the string "Preview" in the source code).

I see.

For more information about printer drivers see:
http://www.haiku-os.org/documents/dev/how_to_write_a_printer_driver

For now there are three strings that should be localized:

  • the name of the pre-installed printer ("Preview" and "Save as PDF file")
  • the name of the printer driver
  • the name of the transport add-on

For translation of the name of a pre-installed printer I don't have a good solution other than handling them specially in the Printers preflet (in PrinterItem::DrawItem() and also in the print_server).

OK.

The right way to get the localized name of a printer driver or transport add-on would be to ask them. In order to do that a new interface would be required. The add-ons for example should export a C function:

void get_display_name(BString* name);

That should return the localized name of the add-on for the currently selected locale.

You cannot simply translate the printer driver and transport add-on names, because these can be added to the system later too (for example developed by a 3rd party developer), then for these the translations would be missing.

OK

About attribute values used by the print kit:
The information about installed printers is not stored in data files, but in folders and attributes of these folders. Have a look into /boot/home/config/settings/printers. For each installed printer you will find there a folder. The folder name is based on the installed printer name (but can be different in case it contains characters not allowed in a file name). The printer name, used printer driver name, used transport add-on name, and so on are stored in file attributes.

You can use in the Terminal in the mentioned "printers" folder:

listattr Preview

To list the attributes attached to the "Preview" folder. And for example

catattr "Driver Name" Preview

to display the name of the used printer driver.

Thank you. You just sketched a model of wire for dummies. :))

comment:11 by Karvjorm, 14 years ago

Another stupid question:

property_info is used in many places. Only part of struct is used. Could we use an unused part of struct to save a localized name. Field extra_data is used in scripting purposes, but if this is not always necessary, we could create a struct like this (without endianness changes):

struct replace_property_info {
 	const char*		name;
 	uint32			commands[10];
 	uint32			specifiers[10];
	const char*		usage;
 	union {
 		struct {
 			uint32	extra_data;
 			uint32	types[10];
 		};
 		const char 	localized_name[44];
 	};
	compound_type		ctypes[3];
 	uint32		 	_reserved[10];
};

or if extra_data cannot be used, then something like that:

struct replace_property_info {
 	const char*		name;
 	uint32			commands[10];
 	uint32			specifiers[10];
 	const char*		usage;
 	uint32			extra_data;
 	union {
		uint32 	 	types[10];
 		const char 	localized_name[40];
 	};
 	compound_type		ctypes[3];
 	uint32		 	_reserved[10];
};

in reply to:  11 comment:12 by laplace, 14 years ago

Replying to Karvjorm: I don't quite understand what that would solve for us? The printer driver and transport add-ons don't support scripting.

comment:13 by humdinger, 12 years ago

Owner: changed from laplace to nobody
Status: newassigned

comment:14 by diver, 4 years ago

Keywords: localization added; Preview Save as PDF removed

comment:15 by bitigchi, 4 years ago

Bump. Might be easy to tackle.

comment:16 by pulkomandy, 4 years ago

Please don't do that. It just adds noise to the ticket comments. No ticket is forgotten here :)

In particular you just moved these tickets *down* in the "inactive tickets" list: https://dev.haiku-os.org/query?status=assigned&status=in-progress&status=new&status=reopened&order=changetime

Last edited 4 years ago by pulkomandy (previous) (diff)

comment:17 by pulkomandy, 4 years ago

Milestone: R1R1.1
Note: See TracTickets for help on using tickets.