To make Image Uploader easier to use for non-English users, we provide a possibility to change all text that can ever be displayed by the control. Each text label, button caption, or error message can be changed using the appropriate property.
There are two ways to add the translation of the control:
In the first case, necessary text properties with translation are added just like any other Image Uploader property. Additionally, you need to localize installation progress which is represented by the InstallationProgressExtender class defined in the iuembed.InstallationProgress.js file of Image Uploader embedding scripts library.
Here is a list of its properties necessary for localization:
Read the Using Image Uploader Installation Progress topic for a full list of the InstallationProgressExtender properties.
<script type="text/javascript" src="iuembed.js"> </script> <script type="text/javascript" src="iuembed.InstallationProgress.js"> </script> <script type="text/javascript"> var iu = new ImageUploaderWriter("ImageUploader", 710, 500); //...Other params and event handlers //ImageUploader text properties iu.addParam("DropFilesHereText", "Drop files here"); //...more ImageUploader text properties //InstallationProgressExtender text properties var ip = new InstallationProgressExtender(iu); ip.setCommonHtml("<p>Aurigma Image Uploader ActiveX control is necessary to upload " + "your files quickly and easily. You will be able to select multiple images " + "in user-friendly interface instead of clumsy input fields with <strong>Browse</strong> button.</p>"); ip.setJavaProgressHtml("<p><img src=\"{0}\" /><br />Loading Aurigma Image Uploader Java Applet...</p>"); //...more InstallationProgressExtender text properties //...Other params and event handlers iu.writeHtml(); </script>
Pay attention to the differences in syntax when localizing ImageUploader and InstallationProgressExtender properties.
When translating the values of the properties, you may notice that some of them contain words in
brackets like [Limit]
, [Name]
, and so on. These are
placeholders that should not be translated. In runtime they will be replaced with the appropriate values
depending on the message displayed.
For example, you set the file size limit of 5 MB, and the user wants to upload a 10 MB image named My File.jpg. In this case, the MessageMaxFileSizeExceededText property will be used in a warning message. By default, it has the value:
The file [Name] cannot be selected. This file size exceeds the limit ([Limit] KB).
And when the user sees this text, it will already contain corresponding values:
The file My File.jpg cannot be selected. This file size exceeds the limit (5120 KB).
See reference on the appropriate properties to learn more about the meaning of particular placeholders.
If you want to specify multiline text use the "\n"
sequence to separate lines.
The second approach allows switching languages dynamically, i.e. you can change them depending on the user's choice.
Suppose, you want to have Image Uploader translated both into English and Portuguese. Then you need to do the following:
pt_resources
object which exposes the following members:
//iuembed.Localization_pt.js pt_resources = { addParams : IULocalization.addParams, Language : "Portuguese", ImageUploader : { //translation of ImageUploader text parameters to Portuguese //... other translations MinutesText : "minutos", SecondsText : "segundos" } }
<html> <head> <script src="iuembed.Localization_en.js" type="text/javascript"> </script> <script src="iuembed.Localization_pt.js" type="text/javascript"> </script> <!--... Other files with translations ...--> </head> <body> <!--... Omitted for brevity ...--> <select id="SelectLanguage" onchange="SelectLanguage_change();" NAME="SelectLanguage"> <option value="en" selected="selected">[en] - English</option> <option value="pt">[pt] - Portuguese</option> <!--... Other languages ... --> </select> <!--... Omitted for brevity ...--> </body> </html>
<script src="../iuembed.js" type="text/javascript"> </script> <script type="text/javascript"> //<![CDATA[ var iu = new ImageUploaderWriter("ImageUploader1", 650, 500); //... Omitted for brevity ... switch (lang) { //The value in the case statement should be the same as in the //value attribute of the OPTION element for this language, hence, //here "pt" is used case "pt": pt_resources.addParams(iu); break; //... Cases of other languages } //... Omitted for brevity ... </script>
You can use enclosed translations into the following languages: