PortableApps.com - Your Digital Life, Anywhere

[Language]

Many applications need quite complex language handling with unique names for languages, files which need checking, other validation and similar things. These two sections are designed to aid you to do this. They take input from the developer and manipulate values in the way specified to produce the environment variable %PAL:LanguageCustom% in the end which can be used in any values in the rest of the file marked “Environment variable substitions apply.”.

Details on how this is constructed are available in the document Setting a custom language environment variable.

Base

Mandatory if section used.

The base string upon which languages are based. This should contain (and probably be) one of the language environment variables.

Default

If the base value is not found in the [LanguageStrings] section, it will be set to this value. If this value is not set it will fall back to the base value.

CheckIfExists


Check if this file exists. To check for a directory add \*.* to the end. If the file does not exist it will fall back to the DefaultIfNotExists value.

DefaultIfNotExists


If the file in CheckIfExists did not exist, the custom language variable will be set to this value.

[LanguageStrings]

Format: arbitrary INI pairs.

Values in the [Language]:Base will be looked up here by key name and the values returned after environment variable parsing.

[LanguageFile]

For reading the custom language variable from a file for when the portable application is not launched from the PortableApps.com Platform. The values which must be set depend on the Type specified below.

Type

Values: ConfigRead, INI, XML attribute, XML text
Mandatory.

Specify the type of file reading which is to be used:

  • ConfigRead: read arbitrary data to a file, the line on which to read being selected as one starting with the Entry.
  • INI: read a string from an INI file.
  • XML attribute: read the string from an attribute value in an XML file.
  • XML text: read the string from a text node in an XML file.

Both ConfigRead and INI are Unicode-compatible. The encoding (ANSI, UTF-8 or UTF-16LE) will be detected automatically from the file’s BOM.

Changed in version 2.1: previously ConfigRead was not able to read from UTF-16LE files.

File


Specify the file which will the value will be read from.

Entry

Mandatory for Type=ConfigRead.

The value will be written to a line starting with this value. This should be set to the text to search for at the start of a line. In an INI-style file, this would be key=, and in an XML file it might be '     <config id="something">'; note that you must include any leading whitespace which will be in the file, and if there is any leading or trailing whitespace you must quote the string with single (') or double (") quotes.

If you need to cut something off the end such as a quotation mark or a closing XML tag, see [LanguageFile]:TrimRight.

Section

Mandatory for Type=INI.

The INI section to read the value from.

Key

Mandatory for Type=INI.

The INI key to read the value from.

Attribute

Mandatory for Type=XML attribute

The attribute to read the value from. See Dealing with XML data for more details.

XPath

Mandatory for Type <[LanguageFile]:Type=XML attribute, XML text.

Specify the XPath to find the place to read from. It is a good idea to make sure that you have a solid understanding of how XPaths work and how to use them before writing one.

For information about what this should look like, see Dealing with XML data.

CaseSensitive

Values: true / false
Default: false
Applies for Type=ConfigRead.
Optional.

Case sensitive searches are somewhat faster than case-insensitive searches. If you can do a case-sensitive ConfigRead, do.

TrimRight

Optional.

If you need to remove something from the right of a line which you have read, for example if you want to get rid of a file extension, a quotation mark, a closing XML tag or similar, put the text in here and if it is at the end of the string it will be removed. Remember the rule about whitespace and quotation marks.

Table Of Contents

Browse

You are here: