Takes one parameter, Source


Moxie has the ability to compose different languages together and have only the correct language outputted to the user. This command and related commands standardize how text lives outside of the Procedures Code where Office Staff (non-programmers) are able to edit that text.

The BuiltIn table which also stores the BuiltIn Procedures is used to store the default text values for Lang values that are used by the BuiltIn Procedures. The table named Content.Lang is used to store the text values beyond those specified in the BuiltIn Table, and will override the values from BuiltIn. The 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, which is called by the Lang command, is built directly into the Database Object instead of the Query Object in order to optimize what is a Database read intensive operation when heavily used in a multilingual system. 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 also 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 be entered at the end of a block of development as well as make it clear what values are missing.

In order to lessen the typing volume when using full language Alias paths, the 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.


    [New] WelcomeText = Lang$ "Hello.World"