Application Settings - Language and Localization
ExeOutput for PHP provides localization support for your applications. Explanatory field text and dialog captions can display in the language of your choice when your application is run. This tab allows you to manage the localization of your application and to load/save language files.
Resource Strings¶
Resource strings are specific string constants used to translate different messages and captions of the user interface's items such as menus, buttons, and window titles.
Imagine you want to build an application in both French and English. Instead of translating all texts in the different fields and finding all options and actions, you just need to modify a list of strings: this is the goal of the resource string editor.
Resource strings can be invoked in specific places such as button captions with the percent symbol %
inserted before and after a constant: %SAbout%
. These "string identifiers" take the place of string variables or literals. Applications replace each string identifier with its string value at runtime.
You can also put resource strings directly in your HTML pages (see below).
To edit a resource string, simply select it from the list and the editor will appear:
Modify the contents of the Value field, and press Apply to save the resource string's new value.
To add a resource string, click "Add String" and you will be prompted to enter the name for the new resource string. Its name should begin with an S
, contain no spaces or special characters (only alphanumeric ones) and must be unique. You can then edit the value of the new resource string and press Apply to finish.
To remove a resource string, select it and click Remove. Only resource strings that you have added (user resource strings) can be removed.
How to put a resource string directly into your PHP and HTML pages¶
With PHP, you can call the ExeOutput built-in function named exo_get_resstring:
<?php echo exo_get_resstring('[name of the resource string]'); ?>
For instance, to display the copyright text:
<?php echo exo_get_resstring('SPubCopyright'); ?>
In HTML pages, you have to use JavaScript code.
<script language="JavaScript">
function DemoCallback(content) {
document.getElementById('demo').outerHTML = '<p>' + content + '</p>';
}
</script>
<div id="demo"></div>
<script language="JavaScript">
exeoutput.GetString("[name of the resource string]", DemoCallback);
</script>
Strings for System HTML pages¶
These specific strings can only be used in dialog boxes to translate their titles and messages.
They can be invoked with the following syntax: [#ID]
where ID
is the "string identifier". Such IDs always begin with Y
e.g. [#YAbout]
will be replaced by the value of "YAbout
" which is "About".
They are not available at runtime contrary to resource strings: all references to these strings are directly replaced when ExeOutput for PHP compiles the application.
Managing these strings is exactly the same as for resource strings: see above.
About language files¶
You can import/export all strings from/to language files. These files are given the .exol
extension. Use the Load/Save buttons to import or export language files.
Thus language files may be used in different applications. You can even share them with others.
Please update the properties of a language file if you plan to distribute it. Properties are only for informative purposes at this time, but this may change in the future. The locale number is the numeric "language identifier" of the language. Visit http://msdn.microsoft.com/en-us/library/dd318693 for the list of available language identifiers.
Current strings are automatically saved in the project file, so you do not need to maintain a language file for your project.
You can specify a default language file in the Environment Options so that it is always loaded when a new project is created.
Additional resource strings¶
Some resource strings are automatically created by ExeOutput for PHP when compiling your application:
-
SPubTitle
contains the title of your application. -
SPubHomepage
contains the default homepage URL. -
SPubAuthor
contains the author name. -
SPubCopyright
contains the copyright of your application. -
SPubEMail
contains the author E-Mail. -
SPubVersion
contains the version number of your application, as defined in the Resources page. -
SPubProductVer
contains the product version number of your application, as defined in the Resources page.
You can use these resource strings in your PHP scripts, HTML pages and JS scripts.