[Inso Home Page] [Home] [Collection] [Book] [Expand] [Collapse] [Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] [Preferences] [Print] [Help]

 inside  Expand Search


   How DynaWeb Views Collections and Books   [Table of Contents]    Query Expansion

DynaWeb Publishers Guide

[-] 3. Overview of DynaWeb Configuration Files
[-] Localizing DynaWeb

Localizing DynaWeb

This section provides an in-depth look at how DynaWeb localizes its strings for requests in different languages. Topics include: how DynaWeb handles localization, the localize.dwc file, adding languages to the localize.dwc file, changing the text that appears in your DynaWeb interface, and issues concerning merging existing configuration files into the new localizable configuration files.

How DynaWeb Handles Localization

In previous versions of DynaWeb, if a publisher wanted to serve out requests in different languages he had to perform a few steps. Publishers would have had to create new versions of any configuration file that contained a string that DynaWeb needed to display during a request. In addition, the publisher would have had to modify DynaWeb to check the requested language of an incoming request and route them to a different set of configuration files, or a different port altogether.

In DynaWeb 4.0.2, all of the strings that DynaWeb needs to display during any request for a collection or book have been gathered into one file, the localize.dwc file. In the templates that generate the HTML, all of the text strings have been replaced with a string ID that tells DynaWeb which string to reference in the localize.dwc file.

When a request comes in, DynaWeb checks for the language and then refers to the corresponding portion of the localize.dwc file to retrieve the proper strings for the string IDs referenced inside the templates.

Caching the localize.dwc File

When the plugin starts up, the contents of localize.dwc are read into memory. During each request, DynaWeb determines the proper language to use and references the correct parameter map in memory. If a new language mapping is added, the server will have to be restarted (or a change made to the dynaweb.dwc file) in order for the additions to be acknowledged.

Determining the Requested Language

DynaWeb checks for the correct language to use by searching in three different places. In order of search, the locations are:

Location

Identifier

URL

The first thing DynaWeb checks for is the presence of a "lang" parameter in the current URL. Languages are specified using the two-letter ISO 649 standard (e.g. "en", "fr", etc.)
Example:
http://.../book/1136;lang=en

accept-lang header

If DynaWeb doesn't find a "lang" parameter in the URL, it checks the request header for an "Accept-Language" value it recognizes. DynaWeb strips the first two letters from the accept-lang string and uses that as the value for the default language.
Note: DynaWeb does not adjust for dialects within an "Accept-Language" header field, such as "en-us".
Example: Accept-Language:en-us returns "en".

dynaweb.dwc

Last, DynaWeb checks the dynaweb.dwc file for the Default__Language parameter.
dwSetParam DefaultLanguage      en

If DynaWeb cannot find a valid setting for a language to use, it defaults to "en".

Localization Strings

All of the text strings DynaWeb uses when serving a request are now contained within the localize.dwc configuration file, in the data/config directory under your DynaWeb installation. Any changes to text appearing in DynaWeb's user interface need to be made inside this file. The strings are grouped according to their function inside DynaWeb according to the following guidelines:

0 -99
Root and Collection level strings.
100 -199
Query strings.
200 -299
Button bar strings.
300 -399
Print strings.
400 -499
Preference Dialog strings.
500 -599
Error strings.
600 -699
Collection Manager strings.

The following table is a list of the string IDs DynaWeb uses and the text strings associated with them.

Note: The same text string may be used in more than one place. Use caution when substituting your own text for a string ID. Never delete a string mapping unless you are CERTAIN that there are no occurrences of it inside the configuration

String Number

Text String

1

DynaWeb 4.1

2

List of Collections on

3

Contents of the

4

Collection

5

Collection Top Level

6

The Root Collection

7

Table of Contents

101

Search for

102

failed

103

invalid query syntax.

104

produced

105

no hits

106

one

107

hit.

108

hits.

109

Search Forms

110

The following search forms are provided for this

111

book:

112

collection:

113

inside

114

all text

201

Inso Home Page

202

Home

203

Book

204

Hide Frames

205

Show Frames

206

Expand

207

Collapse

208

Search Forms

209

Clear Search

210

Previous Hit

211

Next Hit

212

Help

213

Print

214

Previous Page

215

Next Page

216

Table of Contents

217

Search

218

Expand Search

219

Previous Selection

220

Next Section

221

Collection

222

All Collections

223

Previous Hit

224

Next Hit

250

iconhelp.htm

301

Print Selection

302

Select the sections to be printed

303

Print View

304

Print Spooler Type

305

Print Graphics

306

Print Locale

401

Preferences

402

OK

403

Apply Defaults

404

Cancel

405

Global Preferences

406

General:

407

Dynamic Tool Tips:

408

Show Upper Mini TOC:

409

Show Lower Mini TOC:

410

Maximum Page Bytes:

411

Searching:

412

Buttons Around Hits:

413

Sort by Hits:

414

Filtering:

415

Colors:

416

Hit Highlight Color:

417

Button Bar Color:

418

Background Color

419

Query Expansion

420

Language:

421

English:

422

French:

423

German:

424

Italian:

425

Spanish:

426

Japanese

427

Book Level Preferences

428

Stylesheets:

429

Content Stylesheet:

430

TOC Stylesheet:

431

On

432

Off

433

Never

434

Non-Frames Mode

435

Always

436

Thesaurus-Based Query Expansion

437

Stemming

438

Customized Thesaurus

439

Compounding/Decompounding

440

Normalization

441

Maximum Input Terms To Match

442

Maximum Expansions Per Term

443

Minimum Strength of Association

444

default

445

prefhelp.htm

501

This browser does not support frames.

502

Show the non-frames version.

531

Invalid Arguments

532

Invalid arguments were supplied to this program. Be sure to use the associated HTML form with this program. Contact the server administrator if the problem persists.

533

Invalid Selection

534

You did not select any sections to be printed. Be sure to use the associated HTML form with this program. Contact the server administrator if the problem persists.

601

Collection Manager

602

Collection Element Definitions

603

Group Element Definitions

604

Book Element Definitions

605

Add Book

606

Delete Book

607

Add Index

608

Delete Index

609

Update DynaWeb Server

For a guide to the location of the strings in the above table, see the section entitled "Template-Controlled Text" in Chapter 5, "Modifying The DynaWeb Interface."

The localize.dwc File

The localize.dwc is located in the data/config directory underneath the DynaWeb installation. It contains the strings that DynaWeb uses to respond to user requests. If a publisher wishes to add support for another language to the DynaWeb interface, he needs to modify this file.

The localize.dwc file tells the plugin what languages DynaWeb can support inside the UI. By default, DynaWeb only handles English and Japanese, but publishers who need to add other languages can add their own.

The language_list Parameter

DynaWeb sets a variable inside the configuration file called language_list. The language_list parameter states the languages for which a mapping exists. The default appearance of the language_list parameter looks like this:

set language_list {en ja}

This states that the only languages available for DynaWeb is English and Japanese. The language_list parameter takes as values the two-letter ISO 649 standard descriptor for languages. If the publisher were to add French as a potential language, for example, he would have to modify the above to look like this:

set language_list {en ja fr}

He would then have to add a mapping to the localize.dwc file that supplied the French equivalents to the English terms contained in the original mapping.

The string ID mapping

The localize.dwc file contains mappings that assign DynaWeb's text strings to a string ID. These IDs are referenced inside the templates that DynaWeb uses to create the HTML it serves. A portion of the English mapping appears below:

dwSetParam en {
  1  "DynaWeb 4.0.2: The Root Collection"
  2  "List of Collections on"
  3  "Contents of the"
  4  "Collection"
  5  "Collection Top Level"
  101   "Search for"
  102   "failed"
  103   "invalid query syntax."
  104   "produced"
  105   "no hits"
  106  "one"
  107  "hit."
  108  "hits."
[...]
608  "Delete Index"
609  "Update DynaWeb Server"
}

The syntax of a mapping is as follows:

dwSetParam [language_name] {
  stringID "text string here"
}

The value of "language_name" in the above example must be equivalent to the entry in the language_list parameter.

Continuing the first example, to add a mapping for French, we would add a mapping that began:

dwSetParam fr {
....

Simply use the mappings contained in the localize.dwc file and translate them into the language you desire. Then create an identical mapping to the original English one and fill in the strings with the translated text.

Creating New Language Mappings: Example

To add a language to the localize.dwc configuration file, you must add the language to the language_list parameter. Then you must add the new mapping that mimics the structure of the original English mapping, and replace the text strings with their equivalents in the new language.

In this example, we will add Spanish to the localize.dwc file.

  1. Open the localize.dwc file in a text editor. Remember to back up the original file in case you need to revert back.
  2. Add the language to the language_list parameter. "es" is the two-letter ISO 649 naming for Spanish. When we are done, the line should look like this.
    dwSetParam language_list {en ja es}
  3. Copy the entire mapping that starts dwSetParam en {, all the way to the closing brace (}). Copy and paste the mapping below the original mapping inside the localize.dwc file.
  4. Change the line dwSetParam en { to read:
    dwSetParam es {
  5. Translate each English phrase within quotes into its Spanish equivalent. For example:
    212 "Help"

    becomes

    212 "Ayuda"
  6. Save your changes and restart the server. In order to see the new language, set your browser to accept the new language as its primary language. If you do not know how to do this, check your browser's manual or help file.

    Adding Languages with Different Encodings

    Double -byte languages, such as Japanese, are encoded using a scheme other than ISO 8859. If you need to create a mapping that uses an alternate encoding, create a new configuration file such as loc_jp.dwc and source it into the localize.dwc file using the dwSource command. Copy the line in the localize.dwc file that reads:

    dwSource [dwGetParam CONFIG_DIR]/locutil.dwc

    and change locutil.dwc to the filename of the .dwc file you have created. Make sure the new dwSource line comes after the original dwSource entry so it looks like this:

    dwSource [dwGetParam CONFIG_DIR]/locutil.dwc
    dwSource [dwGetParam CONFIG_DIR]/loc_jp.dwc euc-jp

    Make sure you add the encoding of the new configuration file after the name. Construct your new mapping, with the text strings in the appropriate language, into the new configuration file.


       How DynaWeb Views Collections and Books   [Table of Contents]    Query Expansion