https://github.com/stevenblack/intl
Steven Black's INTL Toolkit for Visual FoxPro makes creating international and multilingual applications easy.
https://github.com/stevenblack/intl
localization multilingual toolkit vfp vfp-localization visual-foxpro
Last synced: 5 months ago
JSON representation
Steven Black's INTL Toolkit for Visual FoxPro makes creating international and multilingual applications easy.
- Host: GitHub
- URL: https://github.com/stevenblack/intl
- Owner: StevenBlack
- License: mit
- Created: 2011-10-27T23:02:38.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2020-01-02T00:51:26.000Z (over 6 years ago)
- Last Synced: 2025-03-18T06:31:21.507Z (about 1 year ago)
- Topics: localization, multilingual, toolkit, vfp, vfp-localization, visual-foxpro
- Language: xBase
- Homepage:
- Size: 2.78 MB
- Stars: 30
- Watchers: 4
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# Steven Black's INTL Toolkit for Visual FoxPro
[](https://github.com/StevenBlack/intl/blob/master/license.txt)
[](https://github.com/StevenBlack/intl)
[](https://github.com/StevenBlack/intl/commits/master)
[](https://github.com/StevenBlack/intl/commits/master)
[](https://img.shields.io/github/issues/StevenBlack/intl)
[](https://img.shields.io/keybase/btc/StevenBlack)
***INTL makes short work of creating multilingual software in Visual FoxPro (VFP).***
It gives you the ability to create multilingual Visual FoxPro applications while minimizing the hassles of creating multi-version software.
This document serves to describe the following:
* [The INTL Toolkit](#installing-intl) for Visual FoxPro,
* [GENMENUX](#using-genmenux),
* [non-linguistic and strategic issues](#international-issues) in international development with VFP,
* [VFP’s international features](#vfps-international-features), and
* [other issues germane to spanning locales](#localization-factors-to-consider) with your VFP applications.
## Table of Contents
- [Installing INTL](#installing-intl)
- [INTL: How to...](#intl-how-to)
* [How to Correctly Place Your INTL Files](#how-to-correctly-place-your-intl-files)
* [How to Instantiate an INTL Object](#how-to-instantiate-an-intl-object)
* [How to Localize Forms](#how-to-localize-forms)
* [How to Get Automatic Form Localization](#how-to-get-automatic-form-localization)
* [How to Localize Menus](#how-to-localize-menus)
* [How to Change the Current Language](#how-to-change-the-current-language)
* [How to Swap Languages on the Fly](#how-to-swap-languages-on-the-fly)
* [How to Work With Locales](#how-to-work-with-locales)
* [How to Demo your App in Swahili Today](#how-to-demo-your-app-in-swahili-today)
* [How to Configure Your Main INTL Object](#how-to-configure-your-main-intl-object)
* [How to Configure Strategies](#how-to-configure-strategies)
* [How to Localize Strings](#how-to-localize-strings)
* [How to Localize Fonts](#how-to-localize-fonts)
* [How to Localize Data Sources](#how-to-localize-data-sources)
* [How to Localize Pictures](#how-to-localize-pictures)
* [How to Localize Currencies](#how-to-localize-currencies)
* [How to Localize for Right-To-Left Writing Systems](#how-to-localize-for-right-to-left-writing-systems)
* [How to Subclass an Existing Strategy](#how-to-subclass-an-existing-strategy)
* [How to Create Your Own Generic Strategy](#how-to-create-your-own-generic-strategy)
* [How to Make INTL Ignore an Object](#how-to-make-intl-ignore-an-object)
* [How to Make INTL Treat an Object Differently](#how-to-make-intl-treat-an-object-differently)
* [How to Substitute Your Own Strategies](#how-to-substitute-your-own-strategies)
* [How to Batch-Update `strings.dbf`](#how-to-batch-update-stringsdbf)
* [How to Localize Reports](#how-to-localize-reports)
* [Details of How INTL Works](#details-of-how-intl-works)
* [Details of How `MsgSvc()` Works](#details-of-how-msgsvc-works)
* [How to Distribute INTL Files](#how-to-distribute-intl-files)
* [Toolkit File Descriptions](#toolkit-file-descriptions)
* [Overview of the INTL Class Library](#overview-of-the-intl-class-library)
* [Class `INTL`](#class-intl)
* [Class `cINTLAbstract`](#class-cintlabstract)
* [Class `cINTLCurrency`](#class-cintlcurrency)
* [Class `cINTLData`](#class-cintldata)
* [Class `cINTLFont`](#class-cintlfont)
* [Class `cINTLMemento`](#class-cintlmemento)
* [Class `cINTLPicture`](#class-cintlpicture)
* [Class `cINTLRightToLeft`](#class-cintlrighttoleft)
* [Class `cINTLStrategy`](#class-cintlstrategy)
* [Class `cINTLString`](#class-cintlstring)
- [Localizing VFP Menus](#localizing-vfp-menus)
* [Using GENMENUX to Invoke INTL](#using-genmenux-to-invoke-intl)
* [INTL `config.fpw` Menu Statements](#intl-configfpw-menu-statements)
* [INTL Menu Memory Variables](#intl-menu-memory-variables)
* [Two Very Useful GENMENUX Comment Directives](#two-very-useful-genmenux-comment-directives)
- [Message Services](#message-services)
* [Introduction](#introduction)
* [Up And Running](#up-and-running)
* [`MsgSvc()` Dialog Return Values](#msgsvc-dialog-return-values)
* [Fields in MsgSvc.DBF](#fields-in-msgsvcdbf)
* [`MsgSvc()` Examples](#msgsvc-examples)
* [Localizing Smart](#localizing-smart)
- [INTLTool](#intltool)
* [Iterators And Visitors](#iterators-and-visitors)
* [Updating `strings.dbf` Based on a .PJX](#updating-stringsdbf-based-on-a-pjx)
* [Updating `strings.dbf` Based on a .SCX](#updating-stringsdbf-based-on-a-scx)
* [Updating `strings.dbf` Based on a .VCX](#updating-stringsdbf-based-on-a-vcx)
* [Updating `strings.dbf` Based on a .MNX](#updating-stringsdbf-based-on-a-mnx)
* [Updating `strings.dbf` Based on a .FRX](#updating-stringsdbf-based-on-a-frx)
* [Transforming Reports Based on a .PJX](#transforming-reports-based-on-a-pjx)
* [Transforming Reports Based on a .FRX](#transforming-reports-based-on-a-frx)
* [INTL Iterator Classes](#intl-iterator-classes)
* [Class `INTLVisitor`](#class-intlvisitor)
- [Extend INTL](#extend-intl)
* [Creating and Using Hooks](#creating-and-using-hooks)
- [VFP's International Features](#vfps-international-features)
* [Introduction](#introduction-1)
* [A Survey of VFP's International Features](#a-survey-of-vfps-international-features)
- [International Issues](#international-issues)
* [Background](#background-1)
* [Localization Factors to Consider](#localization-factors-to-consider)
* [Sources of Cultural Difference](#sources-of-cultural-difference)
* [Choosing Enabling Strategies](#choosing-enabling-strategies)
* [Checklist for International Issues](#checklist-for-international-issues)
- [Using GENMENUX](#using-genmenux)
* [Introduction](#introduction-2)
* [GENMENUX Directives](#genmenux-directives)
* [Timing of GENMENUX Drivers and Directives](#timing-of-genmenux-drivers-and-directives)
* [Checklist for GENMENUX](#checklist-for-genmenux)
* [The MNX Structure](#the-mnx-structure)
- [Glossary of Terms](#glossary-of-terms)
- [Acknowledgments](#acknowledgments)
# Installing INTL
First, put the INTL files into a clean new directory.
Then,
* **Deploy files:** Manually place files relative to your project as described in How to [Correctly Place Your INTL Files](#how-to-correctly-place-your-intl-files).
* **Modify the `config.fpw` file:** For menus, add the two lines to the `config.fpw` file as explained in [How to Localize Menus](#how-to-localize-menus).
* **Seed your Form class definition:** For now, probably forever, invoke INTL in forms with a `Form::Init()` statement that calls the INTL object. See [How to Get Automatic Form Localization](#how-to-get-automatic-form-localization).
* If you need localization, **instantiate an INTL object:** Now when localization is required, create and configure an INTL object as described in [How to Instantiate an INTL Object](#how-to-instantiate-an-intl-object).
# INTL: How to...
## How to Correctly Place Your INTL Files
It is important for VFP to find INTL’s files as needed. Here’s where to put your INTL files so they are available to your development environment:
**Deploy your files as follows:**
genmenux.prg- VFP root or the project root directory.
intl.prg- VFP root or the project root directory, or along
SET PATH. strings.dbf strings.fpt strings.cdx- Project root directory, or along
SET PATH. msgsvc.dbf msgsvc.fpt msgsvc.cdx- VFP project root directory, or along
SET PATH.
## How to Instantiate an INTL Object
Create a member named `_SCREEN.oINTL` to hold the INTL instance.
In order to use INTL, your application must instantiate an INTL object. There are many ways to do this, the best being to add it to `_SCREEN`, like this:
```
*-- Anywhere, anytime:
*-- Instantiate INTL in _SCREEN
SET PROCEDURE TO INTL ADDITIVE
SCREEN.AddObject( "oINTL", "INTL" )
```
## How to Localize Forms
Localize forms by passing their object references to the `Localize()`
method of an INTL object.
Forms (and any other container ) are localized by passing its reference to the `oINTL.Localize()` method.
```
*-- Configure oINTL to another language
_SCREEN.oINTL.SetLanguage( "French" )
*-- Instantiate a form. If the form calls INTL in its Init()
*-- method, then the form appears in French....
DO FORM MyForm Name MyForm
```
....or you can localize the form on the fly.
```
_SCREEN.oINTL.Localize( MyForm )
```
## How to Get Automatic Form Localization
**Place a call to `oINTL` in your `Form.Init()` hierarchy.**
To make your forms localize themselves automatically call the `oINTL.Localize()` method in your form class hierarchy. To do so, place the following code in the `Init()` method of your form class definition. |
```
*-- Don't forget to call the ParentClass!
DODEFAULT()
IF TYPE("_SCREEN.oINTL" ) == "O"
_SCREEN.oINTL.Localize( This )
ENDIF
```
## How to Localize Menus
A GENMENUX driver is used to localize menus. To activate GENMENUX and its INTL.PRG driver, put the following lines in your `config.fpw`:
Add these lines to `config.fpw`.
```
*-- Configuring for INTL menus.
_GENMENU = GENMENUX.PRG
_MNXDRV2 = INTL.PRG
*-- End of configuration for INTL menus.
```
Some of these changes require a VFP restart. To avoid restarting FoxPro at this time, issue the following command in the command window:
```
_GENMENU = HOME()+”GENMENUX.PRG”
```
This is all you need to change in your development environment to
localize menus. Henceforth, generate menus as usual.
**GENMENUX is very cool. [Check it out](#using-genmenux).**
**Note**: GENMENUX does not replace VFP’s native menu generator. Since GENMENUX calls GENMENU.PRG, your code is generated by VFP as usual. The INTL Toolkit uses GENMENUX as a pre-processor. GENMENUX is a rich program. Please see [GENMENUX](#using-genmenux) for more information about its capabilities.
## How to Change the Current Language
The structure of `strings.dbf` determines which languages you support.
Use the `SetLanguage()` method to change INTL’s language.
INTL comes with a table named `strings.dbf` which contains a variety of fields, one of which is `cOriginal`, and it may contain other fields for different languages, for example `cFrench`, `cGerman`, `cSpanish`, and so on.
The languages you support are determined by the structure of the `strings.dbf` table. To add a new language change the structure of `strings.dbf`.
To change the current localization language, use the `SetLanguage()` method. Say we want a form to be in French. First set the language, then localize the form:
```
_SCREEN.oINTL.SetLanguage( "French" )
_SCREEN.oINTL.Localize( _SCREEN.ActiveForm )
```
## How to Swap Languages on the Fly
**Nothing demos better than swapping the display language on the fly.**
To swap languages on the fly, which is always a success in a demo (do it even if it isn't required — it's so easy), create a mechanism in your application to configure the INTL object with `INTL.SetLanguage()`, as follows.
```
_SCREEN.oINTL.SetLanguage("German" ) && Configure INTL for German
FOR i = 1 TO ALEN(_SCREEN.Forms ) && Localize active forms
_SCREEN.oINTL.Localize( _SCREEN.Forms[i] )
ENDFOR
DO MAIN.MPR && Refresh the menu too!
```
## How to Work With Locales
To change your application's locale-based personality, I suggest you
subclass `INTL` to work as needed. Subclassing `INTL` for your own needs is a great
way to meet locale demands with a minimum of code and fuss.
Here is an example of an INTL subclass that works for me in a variety of locales.
We subclass the `INTL` class to change all the locale-specific settings at once.
Take note of the RightToLeft strategy (class `cINTLRightToLeft`), which is useful for Middle-Eastern writing systems.
```
DEFINE CLASS MyINTL AS INTL
FUNCTION SetLocale( tcLocale )
IF EMPTY( tcLocale )
tcLocale = this.GetLocale()
ENDIF
IF INTL::SetLocale( @tcLocale )
DO CASE
CASE PROPER(tcLocale )= "Usa"
SET CURRENCY TO "$"
SET CURRENCY LEFT
SET POINT TO "."
SET SEPARATOR TO ","
SET DATE TO American
SET MARK TO "/"
this.SetRightToLeft( .F. )
this.SetConversion( "Usa", 1.33 )
this.SetLanguage( "USEnglish" )
CASE PROPER(tcLocale )= "France"
SET CURRENCY TO " F"
SET CURRENCY RIGHT
SET POINT TO ","
SET SEPARATOR TO "."
SET DATE TO DMY
SET MARK TO "/"
this.SetRightToLeft( .F. )
this.SetConversion( "France", 0.28 )
this.SetLanguage( "French" )
CASE PROPER(tcLocale )= "Germany"
SET CURRENCY TO " DM"
SET CURRENCY RIGHT
SET POINT TO ","
SET SEPARATOR TO "."
SET DATE TO DMY
SET MARK TO "/"
this.SetRightToLeft( .F. )
this.SetConversion( "Germany", 0.28 )
this.SetLanguage( "German" )
CASE PROPER(tcLocale )= "Israel"
SET CURRENCY TO "ILS"
SET CURRENCY LEFT
SET POINT TO "."
SET SEPARATOR TO ","
SET DATE TO British
SET MARK TO "/"
this.SetConversion( "Israel", 0.41 )
this.SetRightToLeft( .T. )
this.SetLanguage( "Hebrew" )
ENDCASE
ENDIF
ENDDEFINE
```
## How to Demo your App in Swahili Today
**INTL is designed to be implemented quickly.**
Here’s what you need to do to localize your application this morning for a multilingual demo this afternoon. If you've used VFP's design tools properly, this is a quick job. If not, this will take a tad longer to engineer.
The basic steps are:
**Install INTL and seed the `Init()` method of your form base classes.**
Follow the steps in the section titled [Installing INTL](#installing-intl). Make sure you review all the steps. Especially important are the steps titled [How to Instantiate an INTL Object](#how-to-instantiate-an-intl-object), [How to Get Automatic Form Localization](#how-to-get-automatic-form-localization), and [How to Localize Menus](#how-to-localize-menus).
**Modify the structure of `strings.dbf` and add one field for each language you need.**
* Copy the `strings.dbf` table that comes with INTL and put it in your project root directory.
* `ZAP` the `strings.dbf` table that you placed in your project root.
* `MODIFY STRUCTURE` of `strings.dbf` and add a new column named `cSwahili` with a length of 120. Note that the "c" in `cSwahili` is required.
**Make your application create an INTL object.** Early in your application, instantiate an INTL object as described in How to [Instantiate an INTL Object](#how-to-instantiate-an-intl-object). Displaying in a different language is now a matter of using its `SetLanguage()` method.
**Do a “Build All”.** Open your project, select "Build", and build an App or Exe, being sure to select "Recompile All Files". Go to lunch.
**To automatically load `strings.dbf`, either run your app or use the INTLTool utility.** There are two ways to populate the `strings.dbf` table with your project's interface strings. The first way is to run your program. As objects are instantiated, INTL will append the strings (like `Caption`, `Tooltiptext`, etc.) into the strings table. A better way is to run the INTLTool update program. See [INTLTool](#intltool).
**Input the translations in the `strings.dbf` table.** In the `cSwahili` column, type-in Swahili translations, complete with hot-keys and shortcut-keys as required.
Note: you can get a "quick-and-dirty" translation for testing and internal demos by doing:
```
`REPLACE ALL cSwahili with "**"+TRIM(cOriginal)+"**" FOR cOriginal <> "(("`
```
## How to Configure Your Main INTL Object
I recommend making a main INTL object named `_SCREEN.oINTL`.
It's possible to have several separate INTL objects co-exist together. Each INTL object is an amalgam of other INTL objects called hooks or strategies. Your main INTL object is the master INTL object in your environment, which I assume is called `_SCREEN.oINTL`.
Use the `SetConfig( n )` method to configure your main INTL object.
You configure INTL with a `_SCREEN.oINTL.SetConfig( n )` method, where `n` is a bitwise integer value with the following interpretation:
| Value | Configuration Meaning |
| --- | --- |
| `1` (Default)
`2`
`4`
`8`
`16`
`32` | Load the String strategy
Load the Font strategy
Load the Data strategy
Load the Picture strategy
Load the Currency strategy
Load the RightToLeft strategy |
**Example: create an INTL object that localizes strings and fonts**
```
*-- create an INTL object
_SCREEN.AddObject("oINTL", "INTL" )
*-- Load the strings and font strategies.
_SCREEN.oINTL.SetConfig( 1 + 2 )
```
The operative language and locale of the main INTL object are configured
with the `SetLanguage()` and `SetLocale()` methods.
## How to Configure Strategies
Strategies are bitwise configured.
Configuring individual strategies as follows: get a reference to the strategy, then configure it. Here are the configuration meanings for each configurable strategy.
| Strategy | Value | Localization |
| --- | --- | --- |
| Data | `1` (Default)
`2`
`4`
`8`
`16` | `BoundColumn`
`ControlSource`
`RowSource`
`RecordSource`
`InputMask`
| Font | `1` (Default)
`2` (Default) | `Font` and `FontSize`
`DynamicFont` and `DynamicFontSize` |
| Picture | `1` (Default)
`2`
`4` (Default)
`8` |`Picture`
`DownPicture`
`Icon`
`DragIcon` |
| RightToLeft | `1` (Default) | All objects reversed within their respective containers |
| Strings | `1` (Default)
`2` (Default)
`4` (Default)| `Caption`
`ToolTipText`
`StatusBarText` |
To get a handle on a loaded strategy, use the `oINTL.GetStrategy()` method.
Thereafter, use the handle's `oINTL.SetConfig()` method to configure the
strategy.
**Example: create an INTL object that localizes strings but not Tooltips**
Use the `oINTL.GetStrategy()` method to get an object reference, then use its `oINTL.SetConfig()` method to configure it.
```
*-- create an INTL object
_SCREEN.AddObject("oINTL", "INTL" )
*-- Load the strings and font strategies.
_SCREEN.oINTL.SetConfig( 3 )
*-- Configure Strings to NOT localize ToolTips
LOCAL loTempHandle
loTempHandle = _SCREEN.oINTL.GetStrategy( "String" )
*-- For the string strategy, the configuration
*-- for Caption and StatusBarText is 5
loTempHandle.SetConfig( 1 + 4 )
```
**Example: create an INTL object that localizes only strings and
InputMasks.**
```
*-- create an INTL object
_SCREEN.AddObject( "oINTL", "INTL" )
*-- Load the strings and data strategies.
_SCREEN.oINTL.SetConfig( 5 )
*-- now modify the data strategy from its default.
LOCAL oTemp
oTemp = _SCREEN.oINTL.GetStrategy( "Data" )
*-- Input masks only.
oTemp.SetConfig( 16 )
```
## How to Localize Strings
Interface strings are usually the first things that come to mind when we think of translating software.
INTL loads only the string strategy by default.
The following table lists the configuration bits for INTL. These configuration bits decide which strategy is loaded. By default, only the String strategy is loaded, which is to say that strings are automatically localized by INTL by default.
| Class | Configuration bits | Localization |
| --- | --- | --- |
| INTL | **`1` (Default)**
`4`
`2`
`8`
`16`
`32` | **`cINTLString` strategy loaded**
`cINTLFont` strategy loaded
`cINTLData` strategy loaded
`cINTLPicture` strategy loaded
`cINTLCurrency` strategy loaded
`cINTLRightToLeft` strategy loaded |
| CINTLString | `1` (Default)
`2` (Default)
`3` (Default) | `Caption`
`ToolTipText`
`StatusBarText` |
Activate the string strategy as follows:
```
*-- cINTLString is loaded by default.
*-- So there’s usually no need to do this
_SCREEN.oINTL.SetStrategy( "String", "cINTLString" )
```
Another more cryptic way to load the String strategy is:
```
-- Set configuration bit 2^0 "ON"
_SCREEN.oINTL.SetConfig( BITSET( oINTL.GetConfig(), 0 ))
```
So there are two ways to do it.
Strings can be localized by providing translations in `strings.dbf`.
| cOriginal | cFrench |
| --------- | ------- |
| `Yes` | `Oui` |
| `No` | `Non` |
**Configure the String Strategy with its `SetConfig()` method.**
The INTL String strategy, like all strategies, is bitwise-configured. You can control the string strategy object as follows:
**Example:** to disable font processing for the `ToolTipText` property:
```
*-- Get a handle on the string strategy:
oFont = _SCREEN.oINTL.GetStrategy( "String" )
*-- We want Caption( 1 ) and StatusbarText( 4 ) only
oFont.SetConfig( 5 )
```
## How to Localize Fonts
Fonts can be locale-specific.
Fonts like Arial, Times New Roman, MS Sans Serif might not be suitable in some languages. This matters; we may need a way to change fonts when we change locales.
The following table lists the configuration bits for the INTL object to load the Font strategy, and the configuration integers to configure the Font strategy.
| Class | Configuration bits | Localization |
| --- | --- | --- |
| INTL | `1` (Default)
**`2`**
`4`
`8`
`16`
`32` | `cINTLString` strategy loaded
**`cINTLFont` strategy loaded**
`cINTLData` strategy loaded
`cINTLPicture` strategy loaded
`cINTLCurrency` strategy loaded
`cINTLRightToLeft` strategy loaded |
| CINTLFont | `1` (Default)
`2` (Default) | `Font` and `FontSize`
`DynamicFont` and `DynamicFontSize` |
Activate the font strategy as follows:
```
*-- cINTLFont is the Font strategy class.
_SCREEN.oINTL.SetStrategy( "Font", "cINTLFont" )
```
Another more cryptic way to load the Font strategy is:
```
*-- Set configuration bit 2^1 "ON"
_SCREEN.oINTL.SetConfig(BITSET(oINTL.GetConfig(),1 ))
```
So there are two ways to do it.
Fonts can be localized by providing translations in `strings.dbf`. Font
specifications are prefixed with the identifier “`((Font ))`”, for example:
| cOriginal | cRussian |
| ----- | ----- |
| `((Font))Courier New,10` | `((Font))Courier New Cyr,10` |
| `((Font))Arial,16` | `((Font))Arial Cyr,16` |
**Configure the Font Strategy with its `SetConfig()` method.**
The INTL Font strategy, like all strategies, is bitwise-configured. You can control the font strategy object as follows:
**Example:** to disable font processing for `DynamicFont` and
`DynamicFontSize`, which will slightly improve the font strategy
performance:
```
*-- Set Font localization on
oINTL.SetConfig( BITSET( oINTL.GetConfig(), 1 )) && Set 2^1 "ON"
*-- Get a handle on the font strategy:
oFont = _SCREEN.oINTL.GetStrategy("Font" )
*-- We want Font and FontSize and to disable DynamicFont
*-- and DynamicFontSize
oFont.SetConfig( 1 )
```
## How to Localize Data Sources
Data can be locale-specific.
Sometimes it is the data itself that needs to be localized. INTL allows you to present different fields for different locales.
The Data strategy works like the other strategies.
The following table lists the configuration bits for the INTL object to load the Picture strategy, and the configuration integers to configure the Picture strategy.
| Class | Configuration bits | Localization |
| --- | --- | --- |
| INTL | `1` (Default)
`2`
**`4`**
`8`
`16`
`32` | `cINTLString` strategy loaded
`cINTLFont` strategy loaded
**`cINTLData` strategy loaded**
`cINTLPicture` strategy loaded
`cINTLCurrency` strategy loaded
`cINTLRightToLeft` strategy loaded |
| CINTLData | `1` (Default)
`2`
`4`
`8`
`16` | `BoundColumn`
`ControlSource`
`RowSource`
`RecordSource`
`InpuMask` |
Activate the data strategy as follows:
```
*-- cINTLData is the Graphics strategy class.
_SCREEN.oINTL.SetStrategy( "Data", "cINTLData" )
```
Another more cryptic way to load the Data strategy is:
```
*-- Set configuration bit 2^2 "ON"
_SCREEN.oINTL.SetConfig(BITSET(oINTL.GetConfig(),2 ))
```
So there are two ways to do it.
Data elements can be localized by providing translations in `strings.dbf`. Data specifications are prefixed with the identifier “`((Data))`”, like for example:
| cOriginal | cRrussian |
| ----- | ----- |
| `((Data))cEngDesc` | `((Data))cRussianDesc` |
**Configure the Data Strategy with its `SetConfig()` method.**
The INTL data strategy, like all strategies, is bitwise-configured. You can control the picture strategy object as follows:
**Example:** Localize ControlSource properties.
```
*-- Set Data localization on
*-- Set 2^2 "ON"
oINTL.SetConfig( BITSET( oINTL.GetConfig(), 2 ))
*-- Get a handle on the data strategy:
oData = _SCREEN.oINTL.GetStrategy("Data" )
*-- We want ControlSource (2)
*-- property localized.
oPicture.SetConfig( 2 )
```
## How to Localize Pictures
**Images can be locale-specific.** Some of the icons and images we use every day may not be appropriate in other locales. INTL provides a way to change the displayed images when we change locales.
**The Picture strategy works like the other strategies.** The following table lists the configuration bits for the INTL object to load the Picture strategy, and the configuration integers to configure the Picture strategy.
| Class | Configuration bits | Localization |
| --- | --- | --- |
| INTL | `1` (Default)
`2`
`4`
**`8`**
`16`
`32` | `cINTLString` strategy loaded
`cINTLFont` strategy loaded
`cINTLData` strategy loaded
**`cINTLPicture` strategy loaded**
`cINTLCurrency` strategy loaded
`cINTLRightToLeft` strategy loaded |
| `cINTLPicture` | `1` (Default)
`2`
`4` (Default)
`8` | `Picture`
`DownPicture`
`Icon`
`DragIcon` |
Activate the picture strategy as follows:
```
*-- cINTLPicture is the Graphics strategy class.
_SCREEN.oINTL.SetStrategy( "Picture", "cINTLPicture" )
```
Another more cryptic way to load the Picture strategy is:
```
*-- Set configuration bit 2^3 "ON"
_SCREEN.oINTL.SetConfig(BITSET(oINTL.GetConfig(),3 ))
```
So there are two ways to do it.
Pictures can be localized by providing translations in `strings.dbf`.
Picture specifications are prefixed with the identifier “`((Picture))`”,
for example:
| `coriginal` | `crussian` |
| ----- | ----- |
| `((Picture))Doctor.BMP` | `((Picture))Doktor.BMP` |
| `((Picture))Friend.BMP` | `((Picture))Comrade.BMP` |
**Configure the Picture Strategy with its `SetConfig()` method.**
The INTL picture strategy, like all strategies, is bitwise-configured. You can control the picture strategy object as follows:
**Example:** Localize Picture, DownPicture, and Icon properties.
```
*-- Set Picture localization on
*-- Set 2^3 "ON"
oINTL.SetConfig( BITSET( oINTL.GetConfig(), 3 ))
*-- Get a handle on the font strategy:
oPicture = _SCREEN.oINTL.GetStrategy("Picture" )
*-- We want Picture (1), DownPicture( 2 ) and Icon (4)
*-- properties localized. 1+2+4 = 7
oPicture.SetConfig( 7 )
```
## How to Localize Currencies
INTL provides a simple yet adaptable multi-currency capability.
INTL enables you to endow your application with a simple multi-currency capability. This architecture is flexible, and by subclassing the `cINTLCurrency` class you can probably implement almost any multi-currency scheme you need.
At the heart of it all, the INTL Currency strategy works only on fields having a format property of "$".
Recall that INTL strategies are bitwise-configured according to the following table.
| Class (with default) | Value | Localization
| --- | --- | --- |
| INTL (1) | `1` (Default)
`2`
`4`
`8`
**`16`**
`32` | `cINTLString` strategy loaded
`cINTLFont` strategy loaded
`cINTLData` strategy loaded
`cINTLPicture` strategy loaded
**`cINTLCurrency` strategy loaded**
`cINTLRightToLeft` strategy loaded |
Activate the currency strategy as follows:
Use `oINTL.SetConfig()` or `oINTL.SetStrategy()` to load the Currency strategy.
```
OINTL = _SCREEN.oINTL
oINTL.SetStratrgy( "Currency", "cINTLCurrency" )
```
An alternate (and more cryptic) way is to use INTL's `SetConfig()` method to make INTL invoke the Font strategy of a given class, as follows:
```
OINTL = _SCREEN.oINTL
*-- Set bit 2^4 "ON"
oINTL.SetConfig( BITSET( oINTL.GetConfig(), 4 ))
```
So there are two ways to do it.
The Currency strategy is not like the others. The INTL toolkit currency strategy is a little different from other strategies in three important respects:
* currencies are *locale*-specific, not language-specific.
* class `cINTLCurrency` does not use class `cINTLString` services, and
* class `cINTLCurrency` makes many input fields read-only when the data is in a converted state.
The default exchange rate for all currencies is `1.00`.
With the `cINTLCurrency` class that ships with INTL, you assign currency conversion factors to different currencies. By default the conversion factor used by the Currency strategy is `1.00`.
If you need time-dependent currency conversions, you can subclass `cINTLCurrency` to do anything you need it to do, such as lookups.
Let's configure INTL for the following currencies: Canadian dollar, Euro, and US dollar. Assume that our data is based in Canadian dollars.
`oINTL.SetConversion()` sets the exchange rate between the original and other locales.
Use `SetLocale()` to change the currency locale. Then localize as usual.
```
oINTL = _SCREEN.oINTL
*-- Load the currency strategy
*-- Set 2^4 "ON"
oINTL.SetConfig( BITSET( oINTL.GetConfig(), 4 ))
*-- Define a few locales and currencies
oINTL.SetConversion( "Canada", 1 )
oINTL.SetConversion( "Euro", 1.55 )
oINTL.SetConversion( "USA", 1.33 )
*-- Lets assume we want to see it in US dollars
oINTL.SetLocale( "USA" )
*-- Localize the current form
oINTL.Localize(_SCREEN.ActiveForm )
```
## How to Localize for Right-To-Left Writing Systems
INTL will automatically make your form objects display from right to left.
INTL enables you to display objects from right-to-left, which is required by Middle-Eastern writing systems. To do this, INTL reverses the location of objects within containers along the vertical centerline of the container. INTL also modifies the alignment property of checkboxes and option groups.
INTL does not change the orientation of caption text. To change the orientation of caption text, you must be using a Middle-Eastern localization of Windows.
The result is forms are reversed; if they were read from left-to-right now they read from right-to-left, and vice-versa.
Recall that INTL strategies are bitwise-configured according to the
following table:
| Class (with default) | Value | Localization
| --- | --- | --- |
| INTL (1) | `1` (Default)
`2`
`4`
`8`
`16`
**`32`** | `cINTLString` strategy loaded
`cINTLFont` strategy loaded
`cINTLData` strategy loaded
`cINTLPicture` strategy loaded
`cINTLCurrency` strategy loaded
**`cINTLRightToLeft` strategy loaded** |
Activate the currency strategy as follows:
Use `oINTL.SetConfig()` or `oINTL.SetStrategy()` to load the Currency strategy.
```
OINTL = _SCREEN.oINTL
oINTL.SetStratrgy( "RightToLeft", "cINTLRightToLeft" )
An alternate (and more cryptic ) way is to use INTL's `SetConfig()` method make INTL invoke the Font strategy of a given class, as follows:
OINTL = _SCREEN.oINTL
`msgsvc.fpt`
`msgsvc.cdx` | If you use `MsgSvc()` you will need to distribute these files. |
| `msgsvc.prg` | The message services library. |
| `nohot.prg` | For best performance, place this function in your first `SET PROCEDURE` file. |
| `strings.dbf`
`strings.fpt`
`strings.cdx` | You’ll need to distribute these too. |
For the STRINGS and MSGSVC tables and files, if you include them in your
APP or EXE then they will, of course, be read-only.
## Toolkit File Descriptions
Here's a description of the files used by INTL. To reckon where these
can be best placed relative to your project, see How to [Correctly Place Your INTL Files](#how-to-correctly-place-your-intl-files).
| File | Description
| --- | --- |
| `addendum.txt` | Late breaking news that may or may not be included in the documentation or the help file. |
| `genmenux.zip` | An archive of the latest available GENMENUX program by Andrew Ross MacNeill. |
| `i.prg` | A stand-alone function that serves as a shortcut to the `_SCREEN.oINTL.I()` method. |
| `intl.prg` | The core code for the classes and utilities in the INTL toolkit. |
| `intltool.prg` | Developer’s utilities to do batch operations on project files and other VFP structures. Do not distribute this file with your applications. |
| `msgsvc.dbf`
`msgsvc.fpt`
`msgsvc.cdx` | Table and supporting files containing messages for dialogs, wait windows, thermometer bars and text blocks. |
| `msgsvc.prg` | The message services library. |
| `nohot.prg` | `nohot()` strips hot key characters from FoxPro prompt expressions. It is a one-line function that you should cut and paste as a procedure somewhere in your application’s invocation stack. |
| `strings.dbf`
`strings.fpt`
`strings.cdx` | Table and supporting files containing translated phrases. |
## Overview of the INTL Class Library
**The INTL class hierarchy is based on class `cINTLAbstract`.** `cINTLAbstract` serves to define the interface for the entire hierarchy. Wherever possible, adding rogue properties, events, and methods to subclasses has been avoided.
The figure below shows an OMT diagram of the INTL class hierarchy.

The INTL class hierarchy.
In normal circumstances, the only objects you’ll probably use are of
class `INTL`.
**Class `cINTLMemento` can be used as a token.**
`cINTLMemento` is a configuration token that INTL objects may use to store details of a specific localization. `cINTLMemento` includes access methods to protected properties.
INTL is the public interface and template methods for the localization
process.
cINTLStrategy is the Parentclass of various localization engines.
**`cINTLString`**, **`cINTLCurrency`**, **`cINTLFont`**, **`cINTLMeasures`**, **`cINTLPicture`**, and **`cINTLData`** are classes of specific strategic implementations.
## Class `INTL`

The INTL class provides services to localize objects and other elements
in your application.
### Class `INTL` Exposed Properties
#### `INTL::cCurrencyStrategy`
**INTL allows you to localize currencies.**
A string specifying the name of the currency strategy class.
| | |
| ----- | ----- |
| **Default** | `"cINTLCurrency"` |
| **Remarks** | You may subclass `cINTLCurrency` to suit your particular needs. You may then use the `SetStrategy("Currency",cYourCurrencyClass)` method to set this currency strategy property to something other than the default. |
| **See Also** | [`cINTLMemento::GetStrategy()`](#cintlmementogetstrategy) |
----
#### `INTL::cDataStrategy`
**INTL allows different data sources for different locales.** A string specifying the name of the data strategy class.
| | |
| ----- | ----- |
| **Default** | `"cINTLData"` |
| **Remarks** | You may subclass `cINTLData` to suit your particular needs. You may use the `SetStrategy("Data", cYourDataClass)` method to set this data strategy property to something other than the default. |
| **See Also** | [`cINTLMemento::GetStrategy()`](#cintlmementogetstrategy) |
----
#### `INTL::cFontStrategy`
**INTL allows the proper fonts to be substituted.**
A string specifying the name of the font strategy class.
| | |
| ----- | ----- |
| **Default** | `"cINTLFont"` |
| **Remarks** | You may subclass `cINTLFont` to suit your particular needs. You may use the `SetStrategy("Font", cYourFontClass)` to set the font strategy property to something other than the default. |
| **See Also** | [`cINTLMemento::GetStrategy()`](#cintlmementogetstrategy) |
----
#### `INTL::cPictureStrategy`
**INTL can localize pictures, icons, and images.**
A string specifying the name of the picture strategy class.
| | |
| ----- | ----- |
| **Default** | `"cINTLPicture"` |
| **Remarks** | You may subclass `cINTLPicture` to suit your particular needs. You may use the ::SetStrategy("Picture", cYourPictureClass ) to set the picture strategy property to something other than the default. |
| **See Also** | [`cINTLMemento::GetStrategy()`](#cintlmementogetstrategy) |
----
#### `INTL::cStringStrategy`
**INTL localizes words and phrases.**
A string specifying the name of the string strategy class. The string strategy class is responsible for localizing strings and phrases in the application, and also serves as a function repository for other strategy classes.
| | |
| ----- | ----- |
| **Default** | `"cINTLSting"` |
| **Remarks** | You may subclass `cINTLString` to suit your particular needs. You may use the `SetStrategy("String", cYourStringClass)` to set the property. |
| **See Also** | [`cINTLMemento::GetStrategy()`](#cintlmementogetstrategy) |
| **The `cINTLString` strategy class is by far the most useful, and it provides services to other strategies.** | **Note:** many strategies use string-based services that are provided by the active string strategy class. To reduce cohesion with a particular `cStringStrategy` class, many string methods that would normally belong in class `cStringStrategy` are found in class `cINTLStrategy`, the parent strategy class. Thus all strategies have some inherent string localization abilities. | |
### Class `INTL` Exposed Methods
----
#### `INTL::Execute()`
Localizes a numeric, a string, an object, or array of objects. In the
case of objects and array of objects, the execute function passes each
object in turn to all the active localization strategies.
| | |
| --- | --- |
| **Syntax** | `oINTL.Execute( @PassedObject )` |
| **Return** | Nothing |
| **Arguments** | `PassedObject`: Can be of type numeric, string, or object. It can also be an array of object references. |
| **See Also** | **INTL::ObjArray()** |
**Example**
```
DIMENSION laScratchArray[1]
SET PROC TO INTL
oINTL = CREATEOBJECT("INTL" )
oXX = CREATEOBJECT("Form" )
*-- Load the array with object references
oINTL.ObjArray( oXX, @laScratchArray )
oINTL.Execute( @laScratchArray )
```
----
#### `INTL::GetAlias()`
| **Strategies may require resource files, which are referenced by alias.**
Returns the alias of the resource table associated with the default localization strategy. Normally, the default strategy object is of class `cINTLString`.
| | |
| --- | --- |
| **Syntax** | `oINTL.GetAlias()` |
| **Return** | The character value of the string strategy table alias. |
| **Arguments** | None. |
| **Remarks** | The `GetAlias()` method is a *hookable* method, meaning that if an object of class `INTL` has an attached hook object, then `GetAlias()` defers to the method of the hook object. Since by default objects of class `INTL` are hooked with an object of the `cINTLStringStrategy` class, invoking `oINTL.GetAlias()` is the equivalent of invoking `oINTL.oStringStrategy.getAlias()`. |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
*-- The following two are equivalent
_SCREEN.oINTL.oStringStrategy.GetAlias()
_SCREEN.oINTL.GetAlias() |
```
----
#### `INTL::GetTable()`
Returns the name of the resource table associated with the string
strategy.
| | |
| --- | --- |
| **Syntax** | oINTL.GetTable()
| **Return** | The character value of the string strategy table name. |
| **Arguments** | None. |
| **Remarks** | The `GetTable()` method is a *hookable* method, meaning that if an object of class `INTL` has an attached hook object, then `GetTable()` defers to the method of the hook object. Since by default objects of class `INTL` are hooked with an object of the `cINTLStringStrategy` class, invoking `oINTL.GetTable()` is equivalent to invoking `oINTL.oStringStrategy.GetTable()`. |
| **See Also** | [`cINTLStrategy::SetTable()`](#cintlstrategysettable) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
*-- The following two are equivalent
_SCREEN.oINTL.oStringStrategy.GetTable()
_SCREEN.oINTL.GetTable()
```
----
#### `INTL::GetUpdateMode()`
Returns the setting for the update mode of the current string strategy.
| | |
| --- | --- |
| **Syntax** | `oINTL..GetUpdateMode()` |
| **Return** | `.T.` if update mode is currently "On", false otherwise. |
| **Arguments** | None. |
| **See Also** | [`cINTLStrategy::SetUpdateMode`](#cINTLStrategySetUpdateMode) |
| **Remarks** | If `GetUpdateMode()` is logical true then, for some strategies, this cause INTL resource files to be self-maintained. For example, the native string strategy will add new strings to `strings.dbf` as they are encountered if the string strategy's update mode is set to true.
The `GetUpdateMode()` method is a *hookable* method, meaning that if an object of class `INTL` has an attached hook object, then `GetUpdateMode()` defers to the method of the hook object. Since by default objects of class `INTL` are hooked with an object of the `cINTLStringStrategy` class, invoking `oINTL.GetUpdateMode()` is equivalent to invoking `oINTL.oStringStrategy.GetUpdateMode()`. |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
_SCREEN.oINTL. GetUpdateMode() |
```
----
#### `INTL::I()`
The `I()` function is an all-purpose localization method.
| | |
| --- | --- |
| **Syntax** | `oINTL.I(cString \| nAmount \| oObject )` |
| **Return** | Localized value of `cString` or `nAmount` or `oObject`. |
| **Argumemnts:** | `cString`: a string to localize. The string could be an interface item, a font name and size, a data source, or a file name.
`nAount`: an amount to localize.
`oObject`: an object (or a container of objects) to traverse. |
| **Remarks** | The `INTL::I()` method is a *hookable* method, meaning that if an object of class `INTL` has an attached hook object, then `INTL.I()` defers to the hook object. Since by default objects of class `INTL` are hooked with an object of the `cINTLStringStrategy` class, invoking `oINTL.I()` is equivalent to invoking `oINTL.oStringStrategy.I()`. |
| **See Also** | **`cINTLMemento::SetLocale()`**
`cINTLCurrency::GetConversion()` |
**Example**
```
this.I("Hello World" )
this.I( nSalary )
```
----
#### `INTL::Init()`
When creating a master INTL object, you may pass 0, 1, 2 or 3 parameters
of type "C", "N", or "O" in any sequence. A character parameter is
assumed to be a language, a numeric parameter is assumed to be a
configuration integer, and an object parameter is assumed to be
something to localize. Note that the language and configuration
parameters are used to initialize the state of INTL.
| | |
| --- | --- |
| **Syntax** | `oX = CREATE( "INTL", [C \| N \| O], [C \| N \| O], [C \| N \| O] )` |
| **Return** | `.T.` always. |
| **Arguments** | You may pass one of each of the following:
Type "C": the language to set.
Type "N": an INTL configuration integer.
Type "O": an object to traverse and localize. |
| **Example** | `oX = CREATE( "INTL", "French", _SCREEN.Activeform )` |
----
#### `INTL::LoadStrategies()`
Loads an array with the strategy objects as implied by
INTL::GetConfig(). Unless you create your own custom mechanisms, you
wouldn't normally call the `LoadStrategies()` method since INTL classes
invoke it when necessary.
| | |
| --- | --- |
| **Syntax** | `oX = CREATE( "INTL" )`
`oX.LoadStrategies()` |
| **Return** | True if successful, false otherwise. |
| **Arguments** | None. |
| **See Also** | **[`cINTLMemento::SetHook`](#cintlmementosethook)** |
**Example**
```
*-- For some reason, refresh the strategies loaded
*-- by the screen INTL object.
_SCREEN.oINTL.LoadStrategies() |
```
----
#### `INTL::Localize()`
Localizes an VFP structure and optionally also sets the locale
characteristics of the main INTL object.
| | |
| --- | --- |
| **Syntax** | `oINTL.Localize( [cLang \| oObj][,cLang \| oObj] )` |
| **Return** | `.T.` if successful, `.F.` if otherwise. |
| **Arguments** | `cLang`: the language to localize the object.
`oObj`: the object to localize. Default is `THISFORM`. |
| **See Also** | [`INTL::Execute()`](#intlexecute) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
_SCREEN.oINTL.Localize( "German", THIS ) |
```
----
#### `INTL::ObjArray()`
The `INTL::ObjArray()` method fills an array with object references for an
object and all the contents of that object.
| | |
| --- | --- |
| **Syntax** | `INTL::ObjArray( oObject, @ArraName )` |
| **Return** | The dimension of the array. |
| **Arguments** | oObject: can be any object but most usually some sort of container, such as a FormSet or a Form. |
| **Remarks** | The object passed for the argument occupies the first item in the array. |
**Example**
```
DIMENSION laScratch[1]
Foo = CREATEOBJECT( "Form" )
Foo.AddObject("Bar", CommandButton )
INTL::ObjArray( Foo, @laScratch ) && yields 2
```
----
#### `INTL::SetConversion()`
Method that allows direct access to the currency strategy if it’s
loaded.
| | |
| --- | --- |
| **Syntax** | `INTL:SetConversion( cLocale, nExchange, xOptional )` |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `cLocale`: the name of a locale.
`Nexchange`: the exchange rate for the locale.
`XOptional`: an optional parameter you can use in subclasses/ |
| **Remarks** | If the currency strategy isn’t loaded, `.NULL.` is returned. |
| **Example**
```
_SCREEN.oINTL.SetStrategy(“Currency” )
*-- Talk directly to the currency strategy
_SCREEN.oINTL.SetConversion(“ USA”, 1.35 )
```
## Class `cINTLAbstract`
**The `cINTLAbstract` class is not designed to be directly instantiated.**
`CINTLAbstract` is the principal base class of the INTL class library. As its name implies, it is an abstract class, and its
main purpose is to define the complete interface for all subclasses.
### Class `cINTLAbstract` Protected Properties
#### `cINTLAbstract::cType`
String used to store the type of INTL class.
| | |
| --- | --- |
| **Default** | “Abstract” |
| **Remarks** | The cType is typically the type of strategy, such as “String”, “Font”, “Currency”, and so on. |
| **See Also:** | `cINTLAbstract::GetType()` |
----
#### `cINTLAbstract::Visible`
Logical used to control this INTL objects visibility.
| | |
| --- | --- |
| **Default** | Logical false. |
| **Remarks** | There is no reason to make visible any member of the INTL class hierarchy. |
### Class `cINTLAbstract` Exposed Properties
#### `cINTLAbstract::INTL_Abstract_ID`
Used by the INTL class for identification purposes.
| | |
| --- | --- |
| **Default** | `"Visual INTL"` |
| **Remarks** | This property should never be changed. |
| **See Also** | [`cINTLAbstract::Name`](#cintlabstractname) |
----
#### `cINTLAbstract::oLogicalParent`
Object reference to the logical parents of INTL objects.
| | |
| --- | --- |
| **Default** | `.NULL.` |
| **Remarks** | This property is useful for callbacks and for error handling. The logical parent property is automatically set by the `SetHook()` method. |
| **See Also** | **`cINTLAbstract::GetLogicalParent()`**
`cINTLAbstract::SetLogicalParent()`
`cINTLAbstract::GetHook()` |
----
#### `cINTLAbstract::oHook`
| | |
| --- | --- |
| **Motivation** | Object reference to the hook object. |
| **Default** | `.NULL.` |
| **Remarks** | This property is used to hold hook objects. |
| **See Also** | **`cINTLMemento::SetHook()`**
`cINTLAbstract::GetHook()` |
----
#### `cINTLAbstract::Name`
The name of this INTL object. Each class, including those you write
yourself, should normally have a distinctive name.
| | |
| --- | --- |
| **Default** | The name of the parent class. |
| **Remarks** | Explicitly assigning a name property, as all INTL classes do, is a good way to increase object instantiation performance. |
### Class `cINTLAbstract` Abstract Methods
The following functions are declared in class `cINTLAbstract` but are in
fact defined in subclasses. Hooked methods are those that, by default,
will message or delegate to an object attached to the ohook reference.
| Function | Remarks |
| ----- | ------- |
| [`cINTLAbstract::aStrat()`](#cintlabstractastrat) | Hooked |
| [`cINTLAbstract::alang()`](#cintlabstractalang) | Hooked |
| [`cINTLAbstract::CreateStrategyTable()`](#cintlabstractcreatestrategytable) | Hooked |
| [`cINTLAbstract::AdornMemento()`](#cintlabstractadornmemento) | |
| [`cINTLAbstract::CreateStrategy()`](#cintlabstractcreatestrategy) | Hooked |
| [`cINTLAbstract::Execute()`](#cintlabstractexecute) | Hooked |
| [`cINTLAbstract::GetConfig()`](#cintlabstractgetconfig) | Hooked |
| [`cINTLAbstract::GetConversion()`](#cintlabstractgetconversion) | Hooked |
| [`cINTLAbstract::GetStrategy()`](#cintlabstractgetstrategy) | Hooked |
| [`cINTLAbstract::GetExplicit()`](#cintlabstractgetexplicit) | Hooked |
| [`cINTLAbstract::GetLanguage()`](#cintlabstractgetlanguage) | Hooked |
| [`cINTLAbstract::GetConfig()`](#cintlabstractgetconfig) | Hooked |
| [`cINTLAbstract::GetTable()`](#cintlabstractgettable) | Hooked |
| [`cINTLAbstract::GetAlias()`](#cintlabstractgetalias) | Hooked |
| [`cINTLAbstract::GetUpdateMode()`](#cintlabstractgetupdatemode) | Hooked |
| [`cINTLAbstract::I()`](#cintlabstracti) | Hooked |
| [`cINTLAbstract::Init()`](#cintlabstractinit) | |
| [`cINTLAbstract::IsValidLanguage()`](#cintlabstractisvalidlanguage) | Hooked |
| [`cINTLAbstract::LoadStrategies()`](#cintlabstractloadstrategies) | |
| [`cINTLAbstract::Localize()`](#cintlabstractlocalize) | Hooked |
| [`cINTLAbstract::LoopOut()`](#cintlabstractloopout) | Hooked |
| [`cINTLAbstract::Mov()`](#cintlabstractmov) | |
| [`cINTLAbstract::objArray()`](#cintlabstractobjarray) | |
| [`cINTLAbstract::OpenStrategy()`](#cintlabstractopenstrategy) | Hooked |
| [`cINTLAbstract::Pitch()`](#cintlabstractpitch) | |
| [`cINTLAbstract::Pop()`](#cintlabstractpop) | |
| [`cINTLAbstract::Push()`](#cintlabstractpush) | |
| [`cINTLAbstract::Release()`](#cintlabstractrelease) | |
| [`cINTLAbstract::SetConfig()`](#cintlabstractsetconfig) | Hooked |
| [`cINTLAbstract::SetConversion()`](#cintlabstractsetconversion) | Hooked |
| [`cINTLAbstract::SetDefaults()`](#cintlabstractsetdefaults) | Hooked |
| [`cINTLAbstract::SetExplicit()`](#cintlabstractsetexplicit) | Hooked |
| [`cINTLAbstract::SetLanguage()`](#cintlabstractsetlanguage) | Hooked |
| [`cINTLAbstract::SetLocale()`](#cintlabstractsetlocale) | Hooked |
| [`cINTLAbstract::SetHook()`](#cintlabstractsethook) | Hooked |
| [`cINTLAbstract::SetStrategy()`](#cintlabstractsetstrategy) | Hooked |
| [`cINTLAbstract::SetAlias()`](#cintlabstractsetalias) | Hooked |
| [`cINTLAbstract::SetTable()`](#cintlabstractsettable) | Hooked |
| [`cINTLAbstract::SetUpdateMode()`](#cintlabstractsetupdatemode) | Hooked |
| [`cINTLAbstract::UpdateResource()`](#cintlabstractupdateresource) | Hooked |
### Class `cINTLAbstract` Exposed Methods
#### `cINTLAbstract::GetHook()`
Returns an object reference to the hook of the object.
| | |
| --- | --- |
| **Syntax** | `this.GetHook()` |
| **Return** | Hook object reference if the current object is hooked, `.NULL.` otherwise. |
| **Arguments** | None. |
| **Example** | `this.GetHook()` |
| **Remarks** | `GetHook()` returns an object reference (if a hook is defined) or `.NULL.` if not. |
| **See Also** | [`cINTLMemento::SetHook()`](#cintlmementosethook) |
----
#### `cINTLAbstract::GetLogicalParent()`
Returns the name of the INTL object’s logical parent.
| | |
| --- | --- |
| **Syntax** | `this.GetLogicalParent()` |
| **Return** | Hook object reference if the current object is hooked, `.NULL.` otherwise. |
| **Arguments** | None. |
| **Example** | `this.GetLogicalParent()` |
| **Remarks** | Returns the name of the INTL object’s logical parent if one has been defined, or `.NULL.` otherwise. |
| **See Also** | [`cINTLAbstract::SetLogicalParent()`](#cintlabstractsetlogicalparent) |
----
#### `cINTLAbstract::IsINTLClass()`
Returns true if a reference is an object belonging to the INTL class.
| | |
| --- | --- |
| **Syntax** | `this.IsINTLClass( Expression )` |
| **Return** | `.T.` if the object is a member of the INTL class. |
| **Arguments** | An expression that may or may not evaluate to type "O". |
| **Example** | `this.IsINTLClass( CREATE( "ComboBox" )) && Returns .F.`|
| **Remarks** | An expression is considered to be a member of the INTL class if it contains an exposed property named `"INTL_Abstract_ID"`. |
----
#### `cINTLAbstract::Release()`
Explicitly releases an INTL object.
| | |
| --- | --- |
| **Syntax** | `_SCREEN.oINTL.Release()` |
| **Return** | `.T.` always. |
| **Arguments** | None. |
| **Remarks** | Releases the current INTL object. Provided for your own benefit if for some reason you need to cleanly release INTL objects. This method is not explicitly called anywhere in INTL. |
----
#### `cINTLAbstract::SetLogicalParent()`
This access method sets the pointer to the object’s logical parent.
| | |
| --- | --- |
| **Syntax** | `oINTL.SetLogicalParent( oObject )` |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | oObject: an object reference. |
| **Example** | `this.SetLogicalParent( _SCREEN.oINTL )` |
| **Remarks** | The logical parent reference is automatically assigned by the `SetHook()` method. INTL classes do not use the logical parent back-pointer reference. Included here for compatibility with some object-oriented error handlers my customers use. |
| **See Also** | [`cINTLAbstract::GetLogicalParent()`](#cintlabstractgetlogicalparent) |
----
#### `cINTLAbstract::GetType()`
Returns the type of INTL object this is.
| | |
| --- | --- |
| **Syntax** | `oINTL.GetType()` |
| **Return** | A string, the object type, such as `“INTL”`, `“String”`, `“Font”`, `“Currency”`, and so on. |
| **Remarks** | When you subclass a strategy, don’t change its type property unless you also change its basic function. |
----
#### `cINTLAbstract::GetVersion()`
Returns the version stamp for your INTL for Visual FoxPro software.
| | |
| --- | --- |
| **Syntax** | `oINTL.GetVersion()` |
| **Return** | A 2-line version signature. |
| **Remarks** | The version number may be important to resolve technical support issues. |
## Class `cINTLCurrency`

**You can subclass the `cINTLCurrency` class to adapt it to your multi-currency needs.** The `cINTLCurrency` class is used to localize currency fields so you can, among other things, swap the
locale on the fly and adjust currency values dynamically. The native `cINTLCurrency` class works with one constant exchange rate per currency. For more complex mechanisms — like
currency conversion lookups as a function of time, subclass the `cINTLCurrency` class and
implement what you need.
### Class `cINTLCurrency` Exposed Methods
----
#### `cINTLCurrency::GetConversion()`
Returns a currency conversion factor.
| | |
| --- | --- |
| **Syntax** | `oINTL.GetConversion( cLocale )`
| **Return** | A numeric conversion factor. |
| **Arguments** | `cLocale`: the name of the local to fetch. |
| **See Also** | [`cINTLCurrency::SetConversion()`](#cintlcurrencysetconversion) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
_SCREEN.oINTL.SetConversion( "Canada", 1.3205 )
_SCREEN.oINTL.GetConversion() && 1.0000
_SCREEN.oINTL.GetConversion( "Canada" ) && 1.3205
_SCREEN.oINTL.SetLocale( "Canada" )
_SCREEN.oINTL.GetConversion() && 1.3205 |
```
----
#### `cINTLCurrency::I()`
Localizes a numeric currency value.
| | |
| --- | --- |
| **Syntax** | `oINTL.I ( nValue )` |
| **Return** | A numeric conversion factor. |
| **Arguments** | `nValue`: the original currency value. |
| **See Also** | [`cINTLCurrency::GetConversion()`](#cintlcurrencygetconversion) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
_SCREEN.oINTL.SetConversion( "Canada", 1.3205 )
_SCREEN.oINTL.GetConversion() && 1.0000
_SCREEN.oINTL.I(10.00 ) && 10.0000
_SCREEN.oINTL.GetConversion( "Canada" ) && 1.3205
_SCREEN.oINTL.SetLocale( "Canada )
_SCREEN.oINTL.GetConversion() && 1.3205
_SCREEN.oINTL.I( 10.00 ) && 13.2050 |
```
----
#### `cINTLCurrency::SetConversion()`
Sets a currency exchange rate.
| | |
| --- | --- |
| **Syntax** | `oINTL.SetConversion( cLocale, nFactor )` |
| **Return** | A numeric conversion factor. |
| **Arguments** | `cLocale`: the name of the local to fetch. |
| **See Also** | [`cINTLCurrency::GetConversion()`](#cintlcurrencygetconversion) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
_SCREEN.oINTL.SetConversion( "Canada", 1.3205 )
_SCREEN.oINTL.GetConversion() && 1.0000
_SCREEN.oINTL.GetConversion( "Canada" ) && 1.3205
_SCREEN.oINTL.SetLocale( "Canada )
_SCREEN.oINTL.GetConversion() && 1.3205 |
```
## Class `cINTLData`

**You can** **display different data in different locales.**
Class `cINTLData` is a strategy used to localize the data sources in your applications. For example, cINTLData can be used to switch the display of data for different locales.
Data translations are kept in `strings.dbf` and are prefixed with the characters “`((Data ))`”. For example: `((Data))Customer.cType`
## Class `cINTLFont`

**To display the characters of some languages, you may need to change fonts.**
Class `cINTLFont` is a strategy used to localize the fonts in your applications. For example, cINTLFont can be used to switch from "Arial" to "Arial CE" or "Arial Cyr" for use in Eastern Europe and the former Soviet Union.
Font translations are kept in `strings.dbf` and are prefixed with the characters “`((Font))`”. For example: `((Font))Arial,10`.
### Class `cINTLFont` Exposed Properties
Here are the exposed properties of class cINTLFont.
#### `cINTLFont::nConfig`
| | |
| --- | --- |
| Default | `3` |
| Remarks | Stores the current configuration information for this font strategy object. |
### Class `cINTLFont` Exposed Methods
Here are the exposed methods of class cINTLFont.
----
#### `cINTLFont::SetConfig()`
| | |
| --- | --- |
| **Syntax** | `oINTL.oFontStrategy.SetConfig( nConfig )` |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `nConfig`: a configuration integer. |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
*-- Load the font strategy
* _SCREEN.oINTL.SetStrategy( “Font" ) && works too
_SCREEN.oINTL.SetConfig( 2 ) && for fonts
*-- Comfigure the font object for all
_SCREEN.oINTL.oFontStrategy.SetConfig( 1 + 2 ) |
```
**Remarks**: The configuration components for cINTLFont are as follows:
* `FontName` and `FontSize`
* `DynamicFontName` and `DynamicFontSize`
## Class `cINTLMemento`

**The `cINTLMemento` class is used to store status and configuration information.**
A `cINTLMemento` object encapsulates all the properties and access methods of INTL objects. This class serves as an INTL configuration token and also the superclass of all INTL master objects and their attached hooks and strategies. |
Thus all useful INTL objects are subclasses of `cINTLMemento`.
### Class `cINTLMemento` Exposed Properties
----
#### `cINTLMemento::Name`
The object name.
| | |
| ----- | ----- |
| **Default** | "`cINTLMemento`" |
----
#### `cINTLMemento::aStrategies[...]`
The array collection of strategy object references.
| | |
| ----- | ------ |
| **Default** | `.NULL.` |
#### `cINTLMemento::oCurrencyStrategy`
An explicit object reference to the string currency strategy.
| | |
| ----- | ------ |
| **Default** | `.NULL.` |
#### `cINTLMemento::oDataStrategy`
An explicit object reference to the data strategy.
| | |
| ----- | ------ |
| **Default** | `.NULL.` |
#### `cINTLMemento::oFontStrategy`
An explicit object reference to the font strategy.
| | |
| ----- | ------ |
| **Default** | `.NULL.` |
----
#### `cINTLMemento::oHook`
Object reference to the hook object.
| | |
| ----- | ------ |
| **Default** | `.NULL.` |
#### `cINTLMemento::oPictureStrategy`
An explicit object reference to the image localization strategy.
| | |
| ----- | ------ |
| **Default** | `.NULL.` |
----
#### `cINTLMemento::oStringStrategy`
An explicit object reference to the string strategy.
| | |
| ----- | ------ |
| **Default** | `.NULL.` |
### Class `cINTLMemento` Exposed Methods
----
#### `cINTLMemento::aStrat()`
Fills an array with the strategy engines found in the current INTL
object.
| | |
| --- | --- |
| **Syntax** | `oINTL.aStrat( @taArray [, nType] )` |
| **Return** | The size or the array, 0 if nothing found. |
| **Arguments** | `taArray`: an array, always passed by reference.
`nType`: the type of array desired
`0 `- Standard 1- D array of strategy names (Default)
`1` - 2-dimension array of strategy names and object references
`2` - 2-dimension array of strategy names and configuration integers |
| **Remarks** | The array must be passed by reference. Like all other FoxPro array functions, the passed array is automatically redimensioned. |
| **See Also** | [`cINTLString::Alang`](#cintlstringalang) |
**Example**
```
DIMENSION MyStrategyArray[1]
_SCREEN.oINTL.SetStrategy( “Font” )
?_SCREEN.oINTL.aStrat( @MyStrategyArray ) && 2
?MyStrategyArray[1] && "String"
?MyStrategyArray[2] && "Font”
?_SCREEN.oINTL.aStrat( @MyStrategyArray,2 ) && 2
?MyStrategyArray[1,1] && "String"
?MyStrategyArray[1,2] && 1
?MyStrategyArray[2,1] && "Font"
?MyStrategyArray[2,2] && 3 |
```
----
#### `cINTLMemento::GetConfig()`
Returns an integer encoding the object’s configuration.
| | |
| --- | --- |
| **Syntax** | `oINTL.GetConfig()` |
| **Return** | Integer. |
| **Arguments** | None. |
| **See Also** | [`cINTLMemento::SetConfig()`](#cintlmementosetconfig) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
? _SCREEN.oINTL.GetConfig() && Returns 1
```
----
#### `cINTLMemento::GetLanguage()`
Returns the localization language to be used by the INTL when localizing
objects.
| | |
| --- | --- |
| **Syntax** | `oINTL.GetLanguage()` |
| **Return** | Character string containing the name of a language. |
| **Arguments** | None. |
| **See Also** | [`cINTLMemento::SetLanguage()`](#cintlmementosetlanguage) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
_SCREEN.oINTL.GetLanguage() && Returns "Original"
```
----
#### `cINTLMemento::GetExplicit()`
Returns true if explicit localization is enabled.
| | |
| --- | --- |
| **Syntax** | `oINTL.GetExplicit()` |
| **Return** | `.T.` if the INTL object is in explicit mode, false otherwise. |
| **Arguments** | None. |
| **See Also** | [`cINTLMemento::SetExplicit()`](#cintlmementosetexplicit) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
? _SCREEN.oINTL.GetExplicit() && Returns .F.
```
----
#### `cINTLMemento::GetLanguage()`
Returns the localization language to be used by the INTL when localizing
objects.
| | |
| --- | --- |
| **Syntax** | `oINTL.GetLanguage` |
| **Return** | Character string containing the name of a language. |
| **Arguments** | None. |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
_SCREEN.oINTL.GetLanguage() && Returns "Original"
```
----
#### `cINTLMemento::GetLocale()`
Returns the value of the INTL object locale property.
| | |
| --- | --- |
| **Syntax** | `oINTL.GetLocale( @oPointer )` |
| **Return** | Name of the current locale. |
| **Arguments** | None. |
| **See Also** | [`cINTLMemento::SetLocale()`](#cintlmementosetlocale) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
_SCREEN.oINTL.GetLocale() && Returns “Defaut”
```
----
#### `cINTLMemento::GetStrategy()`
Returns an object reference to a strategy object.
| | |
| --- | --- |
| **Syntax** | `oINTL.GetStrategy( [cStrategy] )` |
| **Return** | An object reference to a given strategy. |
| **Arguments** | `cStrategy`: a strategy name, the default being `"String"`. Other valid names for native strategies include `"Currency"`, `"Data"`, or `"Font"`. |
| **Example** | `oINTL.GetStrategy( "Currency" )` |
| **Remarks** | The strategy must be loaded for `GetStrategy()` to return a reference. |
----
#### `cINTLMemento::GetStrategyClass()`
Returns the class used for subsequent strategy object instantiations.
| | |
| --- | --- |
| **Syntax** | `oINTL.GetStrategyClass( [cStrategy] )` |
| **Return** | A strategy class name. |
| **Arguments** | `cStrategy`: a strategy name. Valid names for native strategies include `“String”`, `"Currency"`, `"Data"`, `“Picture”`, and `"Font"`. |
| **Example** | `oINTL.GetStrategyClass( "Currency" ) && “cINTLCurrency”` |
----
#### `cINTLMemento::Mov()`
Move selected properties of this object to the object specified.
| | |
| --- | --- |
| **Syntax** | `this.Mov( oObject )` |
| **Return** | True |
| **Arguments** | `oObject`: the INTL class object to configure. |
| **See Also** | [`cINTLMemento::Pitch()`](#cintlmementopitch)
[`cINTLMemento::Pop()`](#cintlmementopop)
[`cINTLMemento::Push()`](#cintlmementopush) |
**Example**
```
oX = CREATEOBJECT( "INTL" )
this.Mov( oX )
```
**Remarks**
You wouldn't normally use this function. The example above is equivalent to performing:
```
oX = CREATEOBJECT( "INTL" )
oX.SetLanguage( this.GetLanguage())
oX.SetConfig( this.GetConfig())
oX.SetExplicit( this.GetExplicit())
oX.SetLocale( this.GetLocale())
ox.SetHook( this.GetHook())
```
----
#### `cINTLMemento::Pitch()`
Removes the internal configuration of an INTL object off a stack.
| | |
| --- | --- |
| **Syntax** | `oINTL.Pitch()`
| **Return** | `.T.` if there was something on stack to pitch. |
| **Arguments** | None. |
| **Example** | `oINTL.Pitch()` |
| **Remarks** | You wouldn't normally use this function unless you have a reason to save and restore INTL’s state. |
| **See Also** | [`cINTLMemento::Pop()`](#cintlmementopop)
[`cINTLMemento::Push()`](#cintlmementopush) |
----
#### `cINTLMemento::Pop()`
Pops the internal configuration of an INTL object off the stack.
| | |
| --- | --- |
| **Syntax** | `oINTL.Pop()`
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | None. |
| **Remarks** | You wouldn't normally use this function unless you have a reason to save and restore INTL’s state. |
| **See Also** | [`cINTLMemento::Pitch()`](#cintlmementopitch)
[`cINTLMemento::Push()`](#cintlmementopush) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
*-- Store the current state
_SCREEN.oINTL.Push() && Returns 1
_SCREEN.oINTL.Pop() && Returns .T.
_SCREEN.oINTL.Pop() && Returns .F. |
```
----
#### `cINTLMemento::Push()`
Stores the internal configuration of an INTL object on a stack.
| | |
| --- | --- |
| **Syntax** | `oINTL.Push()`
| **Return** | The index in the stack where the configuration is stored. |
| **Arguments** | None. |
| **Remarks** | You wouldn't normally use this function unless you have a reason to save and restore INTL’s state. |
| **See Also** | [`cINTLMemento::Pitch()`](#cintlmementopitch)
[`cINTLMemento::Pop()`](#cintlmementopop) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
*-- Store the current state
_SCREEN.oINTL.Push() && Returns 1
_SCREEN.oINTL.Push() && Returns 2
```
----
#### `cINTLMemento::SetConfig()`
Sets the configuration of an INTL object. You can configure INTL to
selectively localize strings, fonts, datasources, graphical elements,
and currency values. By default, INTL will localize the strings in
your interface.
| | |
| --- | --- |
| **Syntax** | `oINTL.SetConfig( nExpression )`
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `nExpression`: a numeric configuration integer. |
| **Remarks** | Invoking `SetConfig()` automatically triggers a call to `LoadStrategies()` to refresh the object's loaded strategies. |
| **See Also** | [`cINTLMemento::GetConfig()`](#cintlmementogetconfig), [`cINTLAbstract::LoadStrategies()`](#cintlabstractloadstrategies) |
**Example**
```
*-- Load the string and font strategies
oINTL.SetConfig( 3 ) |
```
----
#### `cINTLMemento::SetDefaults()`
Sets the operational properties of INTL objects to their defaults.
| | |
| --- | --- |
| **Syntax** | `oINTL.SetDefaults()` |
| **Return** | `.T.` if all operational properties were successfully reset to default. |
| **Arguments** | None. |
| **Example** | `oINTL.SetDefaults()` |
| **Remarks** | The default configuration is set 'at the factory' and cannot be changed programmatically. |
| **See Also** | [`cINTLMemento::SetConfig()`](#cintlmementosetconfig) |
----
#### `cINTLMemento::SetExplicit()`
Sets the INTL object into Explicit mode.
| | |
| --- | --- |
| **Syntax** | `oINTL.SetExplicit( lSetting )` |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `lSetting`: `.T.` to turn on Explicit mode, `.F.` to turn it off. |
| **See Also** | [`cINTLMemento::GetExplicit()`](#cintlmementogetexplicit) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
_SCREEN.oINTL.SetExplicit()
```
----
#### `cINTLMemento::SetHook()`
Sets the hook reference pointer.
| | |
| --- | --- |
| **Syntax** | `oINTL.SetHook( oRefenceObject )`
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `oReferenceObject`: the name of an object to act as reference. A null string nullifies the reference. |
| **See Also** | [`cINTLAbstract::GetHook()`](#cintlabstractgethook) |
**Example**
```
*-- In this example, we substitute our own class
*-- for the INTL string class that normally serves
*-- as the main hook strategy.
_SCREEN.AddObject( "oINTL", "INTL" )
_SCREEN.oINTL.SetHook( CREATE( “MyStringClass” ))
```
----
#### `cINTLMemento::SetLanguage()`
Sets the language for subsequent localization.
| | |
| --- | --- |
| **Syntax** | `oINTL.SetLanguage( cLanguage )` |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `cLanguage`: the language the INTL object will use in subsequent localizations. |
| **See Also** | [`cINTLMemento::GetLanguage()`](#cintlmementogetlanguage) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
_SCREEN.oINTL.SetLanguage( "German" )
```
----
#### `cINTLMemento::SetLocale()`
Set the INTL locale.
| | |
| --- | --- |
| **Syntax** | `oINTL.SetLocale( cLocalename )` |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `cLocalename`: the alias of a locale. |
| **See Also** | [`cINTLMemento::GetLocale()`](#cintlmementogetlocale) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
_SCREEN.oINTL.SetLocale( "SPAIN" )
```
----
#### `cINTLMemento::SetStrategy()`
Loads a strategy.
| | |
| --- | --- |
| **Syntax** | `oINTL.SetStrategy( cStrategy, cClassName \| oObject )` |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `cStrategy`: a strategy name. Valid names for native strategies include "String", "Currency", "Data", or "Font".
`cClass`: the name of a strategy class.
`oObject`: a strategy object. |
| **Example** | `oINTL.SetStrategy( "Currency","cINTLCurrency" )` |
| **Remarks** | The `cStrategy` argument becomes the alias by which the strategy is named. If `cStrategy` is one of the native INTL aliases (`"String"`, `"Font"`, `"Data"`, `"Picture"`, or `"Currency"`) then an automatic `::SetConfig()` is executed. For example, if `oINTL.GetConfig()` returns 1, then after `oINTL.SetStrategy( "Currency", "cMyCurrency" )` it will report `17`. |
| **See Also** | [`cINTLMemento::GetStrategy()`](#cintlmementogetstrategy) |
----
#### `cINTLMemento::SetStrategyClass()`
Sets the class name that is to be used for subsequent strategy object
instantiations.
| | |
| --- | --- |
| **Syntax** | `oINTL.SetStrategyClass( cStrategy, cStrategyClass )`
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `cStrategy`: a strategy name. Valid names for native strategies include `“String”`, `"Currency"`, `"Data"`, `“Picture”` and `"Font"`.
`CStrategyClass`:the name of a class to associate with the strategy name. |
| **Example** | `oINTL.SetStrategyClass( "Currency", “MyCurrencyClass” )` |
| **See Also** | [`cINTLMemento::GetStrategyClass()`](#cintlmementogetstrategyclass) |
### Class `cINTLMemento` Protected Properties
----
#### `cINTLMemento::aStack`
This array member stores the stack of INTL configuration properties.
| | |
| --- | --- |
| **Default** | .NULL.
| **See Also** | [`cINTLMemento::Pitch()`](#cintlmementopitch)
[`cINTLMemento::Pop()`](#cintlmementopop)
[`cINTLMemento::Push()`](#cintlmementopush) |
----
#### `cINTLMemento::cLang`
Stores the current language configuration of this particular INTL
object.
| | |
| --- | --- |
| **Default** | "Original"
| **See Also** | [`cINTLMemento::GetLanguage()`](#cintlmementogetlanguage)
[`cINTLMemento::SetLanguage()`](#cintlmementosetlanguage) |
----
#### `cINTLMemento::cLocale`
Stores the current locale name of this particular INTL object.
| | |
| --- | --- |
| **Default** | "Original"
| **See Also** | [`cINTLMemento::GetLocale()`](#cintlmementogetlocale)
[`cINTLMemento::SetLocale()`](#cintlmementosetlocale) |
----
#### `cINTLMemento::cStringStrategy()`
Default class name for the string strategy.
| | |
| --- | --- |
| **Default** | `"cINTLString"` |
| **See Also** | [`cINTLMemento::GetStrategy()`](#cintlmementogetstrategy)
[`cINTLMemento::SetDefaults()`](#cintlmementosetdefaults)
[`cINTLMemento::SetStrategy()`](#cintlmementosetstrategy)
[`cINTLMemento::aStrat()`](#cintlmementoastrat) |
----
#### `cINTLMemento::lExplicit`
Value is `.T.` if the localization is explicit. Explicit localization
localizes only objects containing "INTL" properties or have associated
references to an INTL object in members named `oINTL`.
| | |
| --- | --- |
| **Default** | `.F.` |
| **See Also** | [`cINTLMemento::aStrategies[...]`](#cintlmementoastrategies[...])
[`cINTLMemento::GetStrategy()`](#cintlmementogetstrategy)
[`cINTLMemento::SetStrategy()`](#cintlmementosetstrategy)
[`cINTLMemento::GetConfig()`](#cintlmementogetconfig)
[`cINTLMemento::SetConfig()`](#cintlmementosetconfig) |`
----
#### `cINTLMemento::nConfig`
Stores the configuration integer for this particular object.
| | |
| --- | --- |
| **Default** | `1` |
| **See Also** | `cINTLMemento::aStrategies[...]`
[`cINTLMemento::GetConfig()`](#cintlmementogetconfig)
[`cINTLMemento::SetConfig()`](#cintlmementosetconfig) |`
----
#### `cINTLMemento::nDefaultConfig`
| | |
| --- | --- |
| **Default** | `3` — meaning both `FontName` and `DynamicFontName` properties are localized.
| **Remarks** | Stores the default configuration for the strategy object. |
| **See Also:** | `cINTLMemento::GetConfig()`
`cINTLMemento::SetConfig()`
`cINTLMemento::SetDefaults()` |
## Class `cINTLPicture`

**Use a `cINTLPicture` strategy to localize graphical elements.**
A `cINTLPicture` strategy object is used to localize the graphical elements of your applications, like bitmaps, icons,
images and graphical mouse cursors. Picture translations are kept in `strings.dbf` and are prefixed with the characters
`“((Picture))”`. For example: `((Picture))Working.BMP`.
## Class `cINTLRightToLeft`

**The `cINTLRightToLeft` strategy is useful for Middle-Eastern cultures.**
A `cINTLRightTiLeft` strategy object is used to reverse a form's objects so the form reads from right to left or vice versa.
This is useful if you are localizing to or from Middle-Eastern writing systems like Hebrew or Arabic.
Note that the `cINTLRightToLeft` strategy only rearranges controls, and does not actually reverse the direction
of the displayed text. To change the direction of the displayed text, you must be using a Middle-Eastern version
of Windows and the RightToLeft properties of the form objects must be logical true.
## Class `cINTLStrategy`

The cINTLStrategy class serves as an abstract class for concrete
localization subclasses.
### Class `cINTLStrategy` Exposed Properties
#### `cINTLStrategy::lStrategyOpen`
Value is `.T.` if, at last indication, the strategy resource files were
open.
| | |
| --- | --- |
| **Default** | Logical false. |
| **Remarks** | This property is set to logical true when the strategy resource table is open, though there is no guarantee that the table won’t be closed. Used purely for performance reasons. |
| **See Also** | `cINTLMemento::aStrategies[...]`
[`cINTLMemento::GetStrategy()`](#cintlmementogetstrategy)
[`cINTLMemento::SetStrategy()`](#cintlmementosetstrategy) |`
#### `cINTLStrategy::nDefaultConfig`
The default configuration integer.
| | |
| --- | --- |
| **Default** | `1` |
| **See Also** | [`cINTLMemento::GetConfig()`](#cintlmementogetconfig)
[`cINTLMemento::SetConfig()`](#cintlmementosetconfig)
[`cINTLMemento::SetDefaults()`](#cintlmementosetdefaults) |`
### Class `cINTLStrategy` Exposed Methods
----
#### `cINTLStrategy::GetAlias()`
Returns the alias of the resource table used by this strategy.
| | |
| --- | --- |
| **Syntax** | `_SCREEN.oINTL.GetAlias()` |
| **Return** | The name of the alias for the strategy’s resource table (if there is one) or `.NULL.` (if there isn’t). |
| **Arguments** | None. |
| **Remarks** | Some strategies may not use resource tables. Note that `::GetAlias()` returns the value of the strategy’s cAlias property, and does not indicate if the resource table actually exists. |
| **See Also** | [`cINTLStrategy::GetTable()`](#cintlstrategygettable) |
**Example**
```
_SCREEN.AddObject( "oINTL","INTL" )
ACTIVATE SCREEN
*-- Since INTL is hooked by the String strategy, the
*-- following two lines are equivalent
? _SCREEN.oINTL.GetAlias() && Returns “Strings.DBF”
? _SCREEN.oINTL.oStringStrategy.GetAlias() && Ditto
```
----
#### `cINTLStrategy::GetTable()`
Returns the name of the strategy object’s resource table.
| | |
| --- | --- |
| **Syntax** | `_SCREEN.oINTL.GetTable()` |
| **Return** | The name of the strategy’s resource table (if there is one) or `.NULL.` (if there isn’t.) |
| **Arguments** | None. |
| **Remarks** | Some strategies may not use resource tables. Note that `::GetTable()` returns the value of the strategy’s `cTable` property, and does not indicate if the resource table actually exists. |
| **See Also** | [`cINTLStrategy::GetAlias()`](#cintlstrategygetalias) |
**Example**
```
_SCREEN.AddObject( "oINTL","INTL" )
ACTIVATE SCREEN
*-- The following two lines are equivalent
? _SCREEN.oINTL.GetTable()
? _SCREEN.oINTL.oStringStrategy.GetTable()
```
----
#### `cINTLStrategy::GetUpdateMode()`
Returns the setting for the update mode of the current strategy.
| | |
| --- | --- |
| **Syntax** | `oINTL..GetUpdateMode()` |
| **Return** | `.T.` if so, false otherwise. |
| **Arguments** | None. |
| **Remarks** | Strategies may possess the ability to automatically update or refresh their resource files. The update mode controls whether this feature is on or off.
| **See Also** | [`cINTLStrategy::SetUpdateMode()`](#cintlstrategysetupdatemode) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
_SCREEN.oINTL. GetUpdateMode()
```
----
#### `cINTLStrategy::I()`
Handles localization tasks of this particular strategy.
| | |
| --- | --- |
| **Syntax** | `cINTLStrategy.I( expr1, expr2 )` |
| **Return** | Typically the localization of expr1 according to `cINTLMemento::GetLanguage()` or `cINTLMemento::SetLocale()`.
| **Arguments** | Varies according to what's required by the strategy subclass instance. Typically `expr1` is a string, a number, or a file name to localize. `Expr2` is usually an additional qualifier. For example, in a custom currency strategy, `expr2` might be used to pass a valuation date. |
----
#### `cINTLStrategy::OpenStrategy()`
Open the strategy object’s resource table.
| | |
| --- | --- |
| **Syntax** | `oINTL.OpenStrategy( [cFileName [,cOptions]] )` |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `cFileName`: the name of the table to open as a resource file. This defaults to what’s returned by `GetTable()`. |
| **Remarks** | Some strategies may not use resource tables. |
----
#### `cINTLStrategy::SetAlias()`
Sets a new value for the alias of the strategy object’s resource table.
| | |
| --- | --- |
| **Syntax** | `oINTL.SetAlias( cAliasName )` |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `cAlias`: the alias of the resource table. |
| **Example** | `oINTL.SetAlias( "C:\\NEW\\Strings.DBF" )` |
| **Remarks** | Some strategies may not use resource tables. |
| **See Also** | [`cINTLStrategy::GetAlias`](#cintlstrategygetalias) |
----
#### `cINTLStrategy::SetTable()`
Sets the name of the strategy object’s resource table.
| | |
| --- | --- |
| **Syntax** | `oINTL.SetTable( cFileName )` |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `cFilename`: the name of a strategy resource table. |
| **Example** | `oINTL.SetTable( "C:\\NEW\\Strings.DBF" )` |
| **Remarks** | Some strategies may not use resource tables. |
| **See Also** | [`cINTLStrategy::GetTable()`](#cintlstrategygettable) |
----
#### `cINTLStrategy::SetUpdateMode()`
Controls the resource updating behavior of this strategy.
| | |
| --- | --- |
| **Syntax** | `oINTL.SetUpdateMode( lOnOff )` |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `lOnOff`: logical true to enable update mode, false to disable. |
| **Remarks** | Some strategies may not support automatic resource updating. |
| **See Also** | [`cINTLStrategy::GetUpdateMode()`](#cintlstrategygetupdatemode) |
### Class `cINTLStrategy` Protected Properties
#### `cINTLStrategy::cAlias`
Stores the alias of the strategy object’s resource table.
| | |
| --- | --- |
| **Default** | `"Strings"` |
| **Remarks** | Some strategies don’t use resource tables. |
| **See Also** | `cINTLStrategy::cTable`
`cINTLStrategy::GetAlias`
#### `cINTLStrategy::cTable`
Stores the resource table name to be used by the strategy object.
| | |
| --- | --- |
| **Default** | `"Strings.DBF"` |
| **Remarks** | Some strategies don’t use resource tables.
| **See Also** | [`cINTLStrategy::cAlias`](#cintlstrategycalias)
[`cINTLStrategy::GetTable()`](#cintlstrategygettable)
[`cINTLStrategy::SetTable()`](#cintlstrategysettable)
[`cINTLStrategy::OpenStrategy()`](#cintlstrategyopenstrategy) |
#### `cINTLStrategy::lUpdate`
value is `.T.` or `.F.`, controlling strategy resource updating.
| | |
| --- | --- |
| **Default** | `.T.` |
| **Remarks** | If the lUpdate property is set to logical true, then INTL will automatically update the resource table as new resource values are encountered. Some strategies don’t use resource tables, and therefore cannot have an lUpdate property set to logical true. |
| **See Also** | [`cINTLStrategy::GetUpdateMode()`](#cintlstrategygetupdatemode)
[`cINTLStrategy::SetUpdateMode()`](#cintlstrategysetupdatemode)
[`cINTLString::UpdateResource()`](#cintlstringupdateresource) |
#### `cINTLStrategy::lUpdateable`
Stores logical `.T.` or `.F.` depending if the strategy resource table is
updateable.
| | |
| --- | --- |
| **Default** | `.T.` |
| **Remarks** | Some strategies don’t use resource tables, and are therefore not updateable. |
| **See Also** | [`cINTLStrategy::GetUpdateMode()`](#cintlstrategygetupdatemode)
[`cINTLStrategy::SetUpdateMode()`](#cintlstrategysetupdatemode)
[`cINTLString::UpdateResource()`](#cintlstringupdateresource) |
## Class `cINTLString`

The `cINTLString` class is the workhorse class in INTL that serves both as
the localization strategy for strings and as a service provider to other
localization strategy classes like `cINTLFont`, `cINTLData`, and
`cINTLPicture`.
In addition, by default, a `cINTLString` object is attached to the primary
hook for the INTL object. Therefore, many calls to the INTL object are
automatically passed through to the string strategy.
### Class `cINTLString` Exposed Properties
Here are the exposed properties of class `cINTLString`.
#### `cINTLString::Name`
Stores the name of the string object.
| | |
| ----- | ----- |
| **Default** | `"cINTLString"` |
### Class `cINTLString` Protected Properties
Here are the protected properties of class `cINTLString`.
#### `cINTLString::nConfig`
Stores the current configuration integer for the string strategy.
| **Default** | `7` |
| --- | --- |
| **Remarks** | Use `SetConfig()` and `GetConfig()` to change the configuration integer.
The string strategy is bitwise configured with the following values:
[`1`] `Caption`
[`2`] `Tooltip`
[`4`] `Statusbartext` |
| **See Also** | [`cINTLMemento::GetConfig()`](#cintlmementogetconfig) |
#### `cINTLString::nDefaultConfig`
Stores the default configuration integer for this strategy.
| **Default** | 7 |
| ----- | ----- |
| **Remarks** | This integer is used in the `SetDefaults()` method, which is used to restore a strategy to its factory defaults. |
| **See Also** | [`cINTLMemento::SetDefaults`](#cintlmementosetdefaults) |
### Class `cINTLString` Exposed Methods
----
#### `cINTLString::Alang()`
Fills an array with the languages supported by the resources of the
string strategy object.
| **Syntax** | `oINTL.Alang( @aArray )` |
| --- | --- |
| **Return** | The number of rows in the array, 0 if nothing found. |
| **Arguments** | An array, passed by reference, to store the language collection. |
| **Remarks** | The array must be passed by reference. Like all other FoxPro array functions, the array will be automatically redimensioned by this function. `Alang()` returns 0 if the strings table is missing. `Alang()` does not leave the strings table open if it was previously unopened. |
| **See Also** | [`cINTLString::IsValidLanguage()`](#cintlstringisvalidlanguage) |
**Example**
```
DIMENSION MyArray[1]
oINTL.ALang( @MyArray )
```
----
#### `cINTLString::CreateStrategyTable()`
Creates the resource table used by this strategy object.
| | |
| --- | --- |
| **Syntax** | `oStringStrategy.CreateStrategyTable()` |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | None. |
| **Remarks** | Some strategies may not use resource tables. |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
LOCAL oX, lcFile
oX = _Screen.oINTL
lcFile = oX.oStringStrategy.GetTable()
IF !ISNULL( cFile ) OR ! FILE( lcFile )
oX.oStringStrategy.CreateStrategyTable() && here it is.
ENDIF
```
----
#### `cINTLString::CreateStrategyCDX()`
Create or recreate the index belonging to the strategy object’s resource
table.
| | |
| --- | --- |
| **Syntax** | `oStringStrategy.CreateStrategyCDX()` |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | None. |
| **Remarks** | Some strategies may not use resource tables. |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
LOCAL oX, lcFile
oX = _Screen.oINTL
lcFile = oX.oStringStrategy.GetTable()
IF !ISNULL( cFile ) OR ! FILE( lcFile )
oX.oStringStrategy.CreateStrategyCDX() && here it is.
ENDIF
```
----
#### `cINTLString::Execute()`
Iterates through a VFP structure, localizing strings.
| | |
| --- | --- |
| **Syntax** | `oINTL.oStringStrategy.Execute( aStructure \| Object )` |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `aStructure`: an array of object references, or `oObject`: a (container) object reference. |
----
#### `cINTLString::IsInResource()`
Returns logical true if the passed string is in the resource table.
| | |
| --- | --- |
| **Syntax** | `oINTL.IsInResource( xTest )` |
| **Return** | `.T.` if the passed string is in the resource table, `.F.` otherwise. |
| **Arguments** | `xtest`: the element to search in the resource table. |
| **Example** | `oINTL.IsInResource( “Cancel” ) && True, probably` |
| **Remarks** | Does not indicate if the resource is localized in the resource table. |
----
#### `cINTLString::IsValidLanguage()`
Returns logical true if the passed language is supported by the string
strategy object.
| | |
| --- | --- |
| **Syntax** | `oINTL.IsValidLanguage( cLanguage )` |
| **Return** | `.T.` if the passed language is supported by the string strategy. |
| **Arguments** | `cLanguage`: a field name (minus the leading "c") in `strings.dbf`. |
| **See Also** | [`cINTLString::Alang`](#cintlstringalang) |
**Example**
```
_SCREEN.AddObject( "oINTL", "INTL" )
*-- The following two are equivalent
_SCREEN.oINTL.IsValidLanguage( "Russian" )
_SCREEN.oINTL.oStringStrategy.IsValidLanguage( "Russian" ) |
```
**Remarks** cLanguage is a valid language if a corresponding field exists in the strategy’s resource table (normally `strings.dbf`). Note that the "c" field-name prefix should not be included in cLanguage. For example, if field cSpanish exists in `strings.dbf`, the following results can be expected:
```
oINTL.IsValidLanguage( "Spanish" ) && Returns .T.
oINTL.IsValidLanguage( "cSpanish" ) && Returns .F. |
```
----
#### `cINTLString::ResourceInsert()`
Inserts an item into the resource table.
| | |
| --- | --- |
| **Syntax** | `oINTL.ResourceInsert( cString [,cOriginFile]` ) |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `cString`: the item to insert into the resource file
`cOriginalFile`: string for the cWhere field. |
| **Example** | `oINTL.ResourceInsert( "New", "MyPrg.PRG" )` |
| **Remarks** | This method inserts an item without regard to duplicates. Use the `cINTLString::IsInResource()` method to determine if the element is a duplicate. |
| **See Also** | [`cINTLString::IsInResource`](#isinresource)
[`cINTLString::UpdateResource`](#cintlstringupdateresource) |
----
#### `cINTLString::SetConfig()`
Sets the configuration of the string strategy object.
| | |
| --- | --- |
| **Syntax** | `oINTL.oStringStrategy.SetConfig( nConfigInteger )` |
| **Return** | `.T.` if successful, `.F.` otherwise. |
| **Arguments** | `nConfigInteger`: a configuration integer that encodes the sum of configuration bytes. The configuration bytes are as follows:
1 Localize Caption properties.
2 Localize Tooltiptext properties.
4 Localize Statusbartext properties. |
| **Remarks** | The default value for `nConfigInteger` is `7`, meaning: localize the `Caption`, `Tooltiptexts`, and `Statusbartext` properties. |
| **See Also** | [`cINTLStrategy::GetConfig()`](#cintlstrategygetconfig) |
**Example**
```
_SCREEN.Addobject( "oINTL","INTL" )
_SCREEN.oINTL.oStringStrategy.SetConfig( 6 ) |
```
----
#### `cINTLString::UpdateResource()`
This method updates the resource file with the passed argument.
| | |
| --- | --- |
| **Syntax** | `oINTL.UpdateResource( xArgument )` |
| **Return** | `.T.` always. |
| **Arguments** | xArgument: the value to insert into the resource table. |
| **Remarks** | Note that the `UpdateResource()` method unconditionally inserts values into the resource table without regard for duplication or type checking. Some strategies may not support resource updating. |
| **See Also** | [`cINTLStrategy::GetUpdateMode()`](#cintlstrategygetupdatemode) |
# Localizing VFP Menus
## Using GENMENUX to Invoke INTL
GENMENUX is a menu generator *shell*. It creates a custom environment
from which it calls the regular FoxPro menu generator `genmenu.prg` (or a
substitute generator of your choice). GENMENUX is hassle-free and, once
installed, you might never think about it again. The following diagrams
illustrate the relationship between `genmenu.prg` and GENMENUX.
The standard FoxPro menu generation process. Metadata created by the
menu builder is processed by `genmenu.prg` to create a FoxPro source code
file. The GENMENUX process. Temporary files, created before and after
the standard FoxPro `genmenu.prg` process, are created and processed by
GENMENUX. GENMENUX allows optional user-defined drivers like INTL.
In general terms, GENMENUX works as follows:
1. GENMENUX copies the metadata (.MNX file) to a temporary file.
2. The temp file is processed for GENMENUX directives and, if desired,
passed through user defined driver programs. The directives and
drivers can add, edit or delete records in the temporary file.
3. The modified temporary file is processed by the standard FoxPro
`genmenu.prg` (or any routine you
specify) to generate a temporary source file (MPR), whose output is
stored in a temporary memo field.
4. GENMENUX processes the temporary source code memo. Here changes can
be made to the actual source code.
5. GENMENUX writes the resulting source code memo to a source file on
disk.
GENMENUX provides a rich set of opportunities for manipulating the
screen generation process. In a few short months, GENMENUX technology
has revolutionized how many developers generate FoxPro menu code.
INTL exploits the opportunities provided by GENMENUX technology by
automatically processing each element of your application’s
user-interface to create linguistic variants.
### Run-Time Menu Localization
Run-time localization is INTL's default behavior. Run-time localization