translate man page on Inferno

Man page or keyword search:  
man Server   579 pages
apropos Keyword Search (all sections)
Output format
Inferno logo
[printable version]

TRANSLATE(2)							  TRANSLATE(2)

NAME
       translate: opendict, opendicts, mkdictname - translation dictionaries

SYNOPSIS
       include "translate.m";
       translate := load Translate Translate->PATH;

       Dict: adt {
	   new:	   fn(): ref Dict;
	   add:	   fn(d: self ref Dict, file: string): string;
	   xlate:  fn(d: self ref Dict, s: string): string;
	   xlaten: fn(d: self ref Dict, s: string, note: string): string;
       };

       init:	   fn();
       opendict:   fn(file: string): (ref Dict, string);
       opendicts:  fn(files: list of string): (ref Dict, string);
       mkdictname: fn(locale, app: string): string;

DESCRIPTION
       The  Translate  module  provides access to the translation dictionaries
       defined by translate(6), intended for the translation of text from  one
       natural language to another.

       Init should be called before using any of these functions.

       Opendict	 opens	a  dictionary  file  (of the format defined below) and
       returns a tuple: a reference to a Dict that represents it and  a	 diag‐
       nostic  string (which is nil if no error occurred).  Opendicts is simi‐
       lar, but loads each of the files in turn into the same Dict,  producing
       a  composite  dictionary in which translations in later files can over‐
       ride translations in earlier ones; the diagnostic string summarises all
       errors (if any).

       Mkdictname  returns  the	 conventional  name of a dictionary file given
       locale and application names.  The locale is normally nil  to  use  the
       current locale, which is formed by binding the desired locale directory
       (or directories) onto /lib/locale.

       Dict.new returns an empty dictionary.  Dict.add loads the given dictio‐
       nary  file  into an existing dictionary, returning a non-nil diagnostic
       string on error.	 Translations are made by Dict.xlate and  Dict.xlaten:
       they  look for a string s (eg, text in one language), optionally quali‐
       fied by a note, and return the corresponding translation text from  the
       dictionary.   If	 no  such translation exists, they return the original
       text s.

EXAMPLE
       The following shows one possible style of use:

       include "translate.m";
	   translate: Translate;
	   Dict: import translate;

       dict: ref Dict;

       X(s: string): string
       {
	   if(dict == nil)
	       return s;
	   return dict.xlate(s);
       }

       init(ctxt: ref Draw->Context, args: list of string)
       {
	   ...
	   translate = load Translate Translate->PATH;
	   if(translate != nil){
	       translate->init();
	       (dict, nil) = translate->opendict(
			   translate->mkdictname("", "vmail"));
	   }
	   ...
	   optioncfg := array [] of {
	       "frame .op -relief flat -borderwidth 8",
	       "frame .op.lbs",
	       "label .op.lbs.a -text {" +
		   X("Voice Mail Active") + ":}",
	       "label .op.lbs.g -text {" +
		   X("Answer Calls With") + ":}",
	       "label .op.lbs.r -text {" +
		   X("Rings before Answering") + ":}",
	       "label .op.lbs.l -text {" +
		   X("Length of Incoming Messages") + ":}}",
	       ...
	   };
	   ...
	   wmlib->tkcmds(top, optioncfg);
       }

       The intermediate function X is defined to allow the program to be  used
       (albeit	with text in English) even when the Translate module cannot be
       loaded.

FILES
       /locale/locale/dict/app

SOURCE
       /appl/lib/translate.b

SEE ALSO
       translate(6)

								  TRANSLATE(2)
[top]

List of man pages available for Inferno

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net