This translation guide provides instructions for creating translations of the CUPS message catalogs and web pages for the Common UNIX Printing System ("CUPS") Version 1.1 software.
CUPS provides a portable printing layer for UNIX®-based operating systems. It has been developed by Easy Software Products to promote a standard printing solution for all UNIX vendors and users. CUPS provides the System V and Berkeley command-line interfaces.
CUPS uses the Internet Printing Protocol ("IPP") as the basis for managing print jobs and queues. The Line Printer Daemon ("LPD") Server Message Block ("SMB"), and AppSocket (a.k.a. JetDirect) protocols are also supported with reduced functionality. CUPS adds network printer browsing and PostScript Printer Description ("PPD") based printing options to support real-world printing under UNIX.
CUPS includes an image file RIP that supports printing of image files to non-PostScript printers. A customized version of GNU Ghostscript 7.05 for CUPS called ESP Ghostscript is available separately to support printing of PostScript files within the CUPS driver framework. Sample drivers for Dymo, EPSON, HP, and OKIDATA printers are included that use these filters.
Drivers for thousands of printers are provided with our ESP Print Pro software, available at:
http://www.easysw.com/printpro/
CUPS is licensed under the GNU General Public License and GNU Library General Public License. Please contact Easy Software Products for commercial support and "binary distribution" rights.
This translation guide is organized into the following sections:
The following CUPS documentation is referenced by this document:
The following non-CUPS documents are referenced by this document:
CUPS uses character set files to define the mapping of local character sets to Unicode code points, as well as the fonts that should be used for different ranges of characters.
CUPS includes files for common 8-bit encodings as well as UTF-8 for Unicode text. The format of these files is described in the CUPS Interface Design Description (IDD) document. Current character sets are enumerated in the CUPS API, so in order to add a new character set you must patch the CUPS source as well as provide a new charset file.
CUPS 1.1 supports the following character sets:
CUPS message catalogs are text files that identify the default character set for the locale and a list of localized message strings for the CUPS software. The format of the message catalog files is described in the CUPS IDD.
Message catalogs are named cups_ll, cups_ll_CC, or cups_ll_CC.charset, where "ll" is the standard 2-letter abbreviation for the language, "CC" is the standard 2-letter abbreviation for the country, and "charset" is the charset name which may differ from the list above.
Each message catalog file is stored in a subdirectory named ll , ll_CC, or ll_CC.charset to match the trailing portion of the message catalog filename.
When translating a new message catalog, copy the cups_C message catalog file to a new subdirectory; to translate the message catalog to Canadian French, you would type the following commands:
cd locale ENTER mkdir fr_CA ENTER cp C/cups_C fr_CA/cups_fr_CA ENTER
Alternatively, you could copy the existing cups_fr message catalog and then make any changes necessary.
Once you have make your copy of the file, edit it using your favorite text editor to translate the text to the desired language. Be sure to preserve any numbers starting in the first column, as they indicate a new message number - you'll see this for the HTTP status messages.
Finally, add your locale to the list of locales in the makefile and run the following command to install it:
make install ENTER
The CUPS scheduler provides a web interface that can be used to do many common printing and administration tasks. The built-in web server supports localization of web pages through the use of subdirectories for each locale, e.g. "fr" for French, "de" for German, "fr_ca" for French in Canada, and so forth.
Template files are HTML files with special formatting characters in
them that allow substition of variables and arrays. The CUPS CGI
programs (admin.cgi
, classes.cgi
,
jobs.cgi
, and printers.cgi
) use these template file
to provide dynamic content for the web interface. Template files are
installed in the /usr/share/cups/templates directory by
default.
Translated versions of the template files should be installed in the appropriate subdirectories under /usr/share/cups/templates. For example, Canadian French template files should be stored in the /usr/share/cups/templates/fr_CA directory.
Template files consist of HTML with variable substitutions for named inside curley braces "{name}". Variable names are generally the IPP attribute names with the hyphen ("-") replaced by the underscore ("_") character. For example, the job-printer-uri attribute is renamed to job_printer_uri.
Curley braces ("{" and "}") to indicate substitutions, and the
backslash ("\") character for quoting. To insert any of these special
characters as-is you need to use the HTML &name;
mechanism
or prefix each special character with the backslash ("\".)
You substitute the value of a variable using {NAME}
in
your template file. If the variable is undefined then the {NAME}
string is output as-is.
To substitute an empty string if the variable is undefined, use
{?NAME}
instead.
The number of array elements can be inserted using {#NAME}
. If the array is undefined then 0 is output. The current array element
(starting at 1) is inserted with {#}
.
Arrays are handled using {[NAME]
at the beginning of a
section and }
at the end. The information between the
closing bracket ("]") and closing brace ("}") is repeated for as many
elements as are in the named array. For example, the following template
will display a list of each job in the job_id
array:
<TABLE> <TR> <TH>Job ID</TH> <TH>Destination</TH> <TH>Title</TH> </TR> {[job_id] <TR> <TD>{?job_id}</TD> <TD>{?job_printer_name}</TD> <TD>{?job_name}</TD> </TR> } </TABLE>
Arrays can be nested, however all elements within the curley braces ("{" and "}") are indexed using the innermost array.
Templates can also test variables against specific values and conditionally include text in the template. The format is:
{variable?true:false} {variable=value?true:false} {variable!value?true:false} {variable<value?true:false} {variable>value?true:false}
where true is the text that is included if the condition
is true and false is the text that is included if the
condition is false. A value of #
is replaced with the
current element number (starting at 1.)
The character after the variable name specifies the condition to test:
Char | Condition |
---|---|
? | True if variable exists. |
= | True if variable is equal to value . |
! | True if variable is not equal to value . |
< | True if variable is less than value . |
> | True if variable is greater than value . |
The following template files are used by the web interface:
CUPS uses four CGI programs to manage the dynamic web interfaces:
admin.cgi
classes.cgi
jobs.cgi
printers.cgi
The admin.cgi
program handles all of the printer and
class administration functions and is run for all direct accesses to
the /admin resource. For most operations it uses the
PRINTER_NAME
and OP
form variables to specify the
action requested.
The following OP
values are supported:
MEMBER_URIS
values can be provided.CONFIRM
may
be set to any value to bypass the confirmation page.CONFIRM
may be set
to any value to bypass the confirmation page.The classes.cgi
program is responsible for listing class
information, including jobs destined for that class. It is for all
direct accesses to the /classes resource and supports the
optional form variables OP
and WHICH_JOBS
. If
no form variables are supplied then the CGI lists all or a specific
class and the active jobs on each class.
The following WHICH_JOBS
values are supported:
The following OP
values are supported:
The jobs.cgi
program handles all of the job functions
and is run for all direct accesses to the /jobs resource.
For most operations it uses the JOB_ID
, OP
,
and WHICH_JOBS
form variables to specify the action
requested.
The following WHICH_JOBS
values are supported:
The following OP
values are supported:
The printers.cgi
program is responsible for listing
printer information, including jobs destined for that printer. It is
for all direct accesses to the /printers resource and
supports the optional form variables OP
and
WHICH_JOBS
. If no form variables are supplied then the CGI lists
all or a specific printer and the active jobs on each printer.
The following WHICH_JOBS
values are supported:
The following OP
values are supported: