Lang$

Takes four parameters, FieldBase, Destination, Source, IfLenFld

Description:

Moxie has had since the beginnings of v3.0 the ability to compose different languages together and have only the correct language outputted to the user. However, it has been missing a standardized way to have that text live outside of the Procedures Code where Office Staff (non-programmers) are able to edit that text.

The relatively new BuiltIn Table which was only storing Procedures but not any data in the Table's Records will be used to store the default text values.

A new Table named Content.Lang exists which can be used to store additional text values beyond those specified in the BuiltIn Table, as well as override the values from BuiltIn.

The new Lang$ Top Query Function and Lang Command when given an Alias will return the correct text value by first looking for a match in the Content.Lang Table and then further checking the BuiltIn Table if it wasn't found in the first.

The Lang$ Function internally is built directly into the Database Object instead of the Query Object in order to optimize what will be a Database Read intensive operation. Another optimization is the requirement that the Value Field (what is returned by the Function) is the last Field in the Table; this prevents the need to manage a cache or continually lookup the Value Field's position in the Table. The Content.Lang and BuiltIn Table IDs are cached.

When the Lang$ Function does not find a match, it does not return and error. Instead it simply returns the Alias that was passed to it as a placeholder. This is done to simplify development, allowing the language values to all be entered at the end of a block of development.

In order to lessen the typing volume when using full language Alias paths, the new Commands of LangWith and End LangWith will set the name base for the Lang$ Function. Unlike WorkWith and TopWith the scope of LangWith is Procedure wide, since it is expected to be set only once at the beginning of a procedure.

Usage:

    FieldBase, Destination, Source, IfLenFld
    [WorkWith], Destination, Source, IfLenFld
    [WorkWith], Destination, Source, [""]
    FieldBase, Destination, Source, [WorkIf]
    [WorkWith], Destination, Source, [WorkIf]


Example:

    LangWith "BuiltIn.Calendar"
        ...then later...
    HtmlErr (Lang$ "InvalidDateRante")