?? bk_overview.html
字號:
<html><head><title>BabelKit Overview</title><link rel="STYLESHEET" type="text/css" href="main.css"></head><!-- Copyright (C) 2003 John Gorman <jgorman@webbysoft.com> http://www.webbysoft.com/babelkit--><body bgcolor="#F0FFFF" text="#000000" link="#873852" vlink="#873852" alink="#B52E2E"><center><table width="600"><tr><td><div align="right">[<a href="bk_update.html">Code Table Updates</a>][<a href="index.html">Index</a>][<a href="bk_schema.html">Code Table Setup</a>]</div><center><h2><a href="http://www.webbysoft.com/babelkit">BabelKit</a>Overview</h2></center>BabelKit is an interface to a universal multilingual database code table.BabelKit takes all of the programming work out of maintainingmultiple database code definition sets in multiple languages.<p>The code administration and translation page lets you definenew virtual code tables, new languages, enter all codesand their descriptions and then translate them into alllanguages of interest.<p>Perl and PHP classes retrieve the code descriptionsand automatically generate HTML code selection elementsin the user's language. This makes internationalizationand localization of web sites and database interfacesmuch easier.<h4>Traditional Code Set Implementations</h4>Code sets are an important part of any database.They define the choices available for codified fieldsand supply the human readable descriptions for display purposes. <p>Code sets are usually implemented as database tables,one physical database table for each set of codes.<p>Each database table typically needs an administrationdata entry page to allow for code set entry and upkeep.Also, each use of each code set requires similarbut slightly different SQL and application code,an opportunity for bugs to slip into the applications.<p>Multilingual code sets are even more work for theprogrammer than unilingual code sets due to thecomplexity of storing and retrieving multiple codedescriptions for each code, one for each languageof interest.<h4>Universal Multilingual Code Table</h4>A universal code table replaces all of the traditional individualdatabase code tables with a single database table whichis structured to hold all of the code sets in theentire database.<p>This saves a <b>lot</b> of programmer work in setting upthe tables and eliminates the need to write multiplecode set administration data entry pages. BabelKitprovides code administration and translation utilitieswritten in both PHP and Perl.<p>A single database table makes it easy to write anAPI for each language of interest to perform commonoperations such as looking up a code descriptionor displaying code choices to the user. BabelKitcurrently provides APIs for PHP and Perl.<h4>Native Language Fallback</h4>The task of maintaining codes and keeping allof the code description translations up to datein all of the languages of interest is notalways complete at any given moment.<p>As a fallback, BabelKit implements the conceptof a 'native language'. A code value becomesdefined when the native language description isfirst entered. If the code description foranother language of interest is not yet availablethe native language version is displayed instead.<h4>Code Set Display Order</h4>It is often necessary to specify the order inwhich code set choices are displayed to the user.<p>BabelKit has a numeric code order field associatedwith each code value. The sort is first by code ordernumerically, then by code value lexicographically.The code order field can be specified at data entry time.If the order field is not specified and the code valueis numeric then that numeric value is used as thecode order value. This keeps numeric code valuessorted numerically by default.<h4>Deprecated Codes</h4>Sometimes codified choices go out of date and areno longer available for user selection. Simplyremoving an obsolete code from the code set creates aproblem when it comes time to display the codedescriptions for obsolete code values which are stillin the database.<p>The solution is to mark obsolete codes as deprecatedwithout removing them from the code set.This leaves the obsolete code descriptionsin the code set for display purposes, but doesnot allow new data entry selection of deprecatedcode choices. BabelKit fully supports deprecated codes.<h4>Phrase and Paragraph User Interface Translation</h4>If you have a multilingual web site or user interfacewhich needs to display pieces of text in variouslanguages BabelKit can help with the translationand retrieval of multilingual phrases and paragraphs.<p>One approach is to create a code set called 'phrase'and another called 'paragraph'. The phase setis used for one line words and phrases.The paragraph set can hold multiline paragraphsor pages of text. Check the 'Multiline Set' boxwhen creating the paragraph set.<p>For software modularity it helps to use code values whichare a combination of the module using the phraseor paragraph and a short name such as 'member-accepted'and 'credit-disclaimer'. That way you will knowexactly which modules will be affected by a changein phrasing. Some phrases may be so universal asto be invariant, so those can be shared betweenmodules as in 'shared-hello'.<h4>Translation Slave Sets</h4>BabelKit can be used to make a unilingual databasefield look multilingual with very little work.For example, you may already have a table of cityrecords, with a single native language city name field.<p>To make city names appear multilingual, create a code setcalled 'city' and check the 'Slave Set' box.The codes for the city code set matchthe city record identifiers, such as 185 or 221.<p>Whenever a city is added or updated call the slave method:<pre>$babelkit->slave('city', $city_id, $city_name);</pre>Use the BabelKit Translation Utility to translatethe city names into the languages of interest.When it comes time to display a city name, callup the correct city name translation like this:<pre>print $babelkit->desc('city', $lang, $city_id);</pre><h4>Parameter Sets</h4>It is often a good idea to keep any application parametersseparate from the application code so that they canbe changed without source code changes. Parametersets are a excellent way to accomplish this.Parameter sets are stored in the native languageonly and are not translated. Use the param()method to get the data.<p>For example if we have a currency conversion application,we can store the currency conversion rates as aBabelKit code set. Create a code set called 'currencyrate'and check the 'Parameter Set' box. This marks thecurrencyrate code set as pure data and will not present it fortranslation in the BabelKit Translation Utility.Data entry is done in the native language only.<p><div align="right">[<a href="bk_update.html">Code Table Updates</a>][<a href="index.html">Index</a>][<a href="bk_schema.html">Code Table Setup</a>]</div></td></tr></table></center></body></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -