Futurama Logo

Welcome to the Futurama Support Site

The Futurama Support Site is the website where you can find Futurama and Futurama Vision documentation. If you have any questions about the support pages or if you want to provide us feedback please send us an e-mail.




Index Text management and Multi-language
Previous  |  Next

 1      About Futurama
 1.1        Version information
 1.2        Getting Started
 1.2.1          Futurama Website
 1.2.1.1            Behavior of Futurama regarding TimeOuts, Login and Logoff
 1.2.1.2            Replacing an existing Futurama Session
 1.2.2          Futurama Webservice
 1.2.2.1            warmUpDocuments
 1.2.3          Futurama Export
 1.3        Overview - Futurama Modules
 1.3.1          Overview - Futurama Accounts
 1.3.2          Overview - Futurama Server
 1.3.3          Overview - Futurama Monitor
 1.3.4          Overview - Futurama Insight
 1.3.5          Overview - Futurama Console
 1.3.6          Overview - Futurama Webservice
 1.4        Loadbalancing Futurama applications
 1.4.1          Getting the most out of Futurama Web using the Load-Balancer
 1.4.2          Application Request Routing
 1.5        Text management and Multi-language
 2      Installation – Configuration – Testing
 2.1        Installation - Futurama Website Edition
 2.1.1          Installation Futurama HTML
 2.1.2          Installation Futurama Monitor
 2.1.3          Installation Futurama Insight
 2.1.4          Installation Futurama Accounts
 2.1.5          Installation SAML2LoadBalancer
 2.2        Installation - Futurama Export Edition
 2.2.1          Installation Futurama Console
 2.2.2          Installation Futurama Server
 2.3        Installation - Futurama Webservice Edition
 2.3.1          Installation Futurama Webservice
 2.4        Installation Futurama Editor
 2.5        Configuration
 2.5.1          Configuration - Cache
 2.5.2          Configuration - Calculation
 2.5.3          Configuration - Debug
 2.5.4          Configuration - File manager
 2.5.5          Configuration - Fileproviders
 2.5.6          Configuration - Format
 2.5.7          Configuration - History
 2.5.8          Configuration - Identity Provider
 2.5.9          Configuration - Log
 2.5.10           Configuration - Mail
 2.5.11           Configuration - Mapping
 2.5.12           Configuration - Monitor
 2.5.13           Configuration - PlugIns
 2.5.14           Configuration - Rendering
 2.5.15           Configuration - ScenarioRecording
 2.5.16           Configuration - Security
 2.5.17           Configuration - Server
 2.5.18           Configuration - Vision
 2.5.19           Configuration - WebAPI
 2.6        Logging
 2.7        Troubleshooting
 2.8        Security - hardening
 3      Updating and file compatibility
 3.1        Updating Futurama - Compatibility behavior
 3.2        Converting Futurama documents
 3.3        12819 - DataTable file updates
 3.4        12889 - DataTable file updates
 3.5        Conversion web.config to .NET Framework 4
 3.6        Deprecated conversion formulas
 4      Futurama Editor - How to
 4.1        At first glance
 4.2        Developing in the Futurama Editor
 4.2.1          Working with objects
 4.2.2          Evaluating objects
 4.2.3          Finding objects
 4.3        Transferring objects
 4.4        Testing objects
 4.5        Validating objects
 4.6        Troubleshooting objects
 4.7        Advanced/special functionality
 4.8        Checking the layout of objects
 5      Futurama - Formulas
 5.1        Futurama Formulas - Date and time
 5.1.1          Date
 5.1.2          Day
 5.1.3          Days360
 5.1.4          Days360Excel
 5.1.5          DaysInMonth
 5.1.6          DaysInPeriod
 5.1.7          Min
 5.1.8          Max
 5.1.9          Month
 5.1.10           Now
 5.1.11           WeekDay
 5.1.12           Year
 5.2        Futurama Formulas - Math
 5.2.1          Abs
 5.2.2          Add
 5.2.3          Divide
 5.2.4          Floor
 5.2.5          Ln
 5.2.6          Log
 5.2.7          Log10
 5.2.8          Mod
 5.2.9          Multiply
 5.2.10           Pi
 5.2.11           Power
 5.2.12           Rand
 5.2.13           Round
 5.2.14           RoundDown
 5.2.15           RoundUp
 5.2.16           SquareRoot
 5.2.17           Subtract
 5.3        Futurama Formulas - Statistical
 5.3.1          AverageDeviation
 5.3.2          Beta
 5.3.3          Binomial
 5.3.4          Covariance
 5.3.5          Factorial
 5.3.6          Gamma
 5.3.7          GeometricMean
 5.3.8          Lognormal
 5.3.9          Max
 5.3.10           Median
 5.3.11           Min
 5.3.12           Normal
 5.3.13           StandardDeviation
 5.3.14           Uniform
 5.3.15           Variance
 5.4        Futurama Formulas - Text
 5.4.1          CalculateBase64Hashcode
 5.4.2          CalculateXmlHashcode
 5.4.3          Concatenate
 5.4.4          ConcatenateBase64
 5.4.5          ContainsText
 5.4.6          Convert.CSV.2.XML
 5.4.7          ConvertFromBase64
 5.4.8          ConvertToBase64
 5.4.9          ConvertXml
 5.4.10           DecodeURL
 5.4.11           DecryptXml
 5.4.12           EncodeURL
 5.4.13           EncryptXml
 5.4.14           Find
 5.4.15           HashBase64EncodedFile
 5.4.16           HashBase64EncodedFileWithBase64
 5.4.17           HashText
 5.4.18           HashTextWithBase64
 5.4.19           Left
 5.4.20           Len
 5.4.21           Linefeed
 5.4.22           Lower
 5.4.23           Mid
 5.4.24           Proper
 5.4.25           ReadConfigKey
 5.4.26           ReadDirectoryNames
 5.4.27           ReadFile
 5.4.28           ReadFileAsBase64
 5.4.29           ReadFileNames
 5.4.30           ReadFileWithEncoding
 5.4.31           ReadXPathScalar
 5.4.32           ReadXPathVector
 5.4.33           Repeat
 5.4.34           Right
 5.4.35           Substitute
 5.4.36           Trim
 5.4.37           TrimLeft
 5.4.38           TrimRight
 5.4.39           Upper
 5.4.40           ValidatePattern
 5.4.41           XsdMessages
 5.5        Futurama Formulas - Logical
 5.5.1          And
 5.5.2          IsEmpty
 5.5.3          If
 5.5.4          IsEqual
 5.5.5          IsEven
 5.5.6          IsGreater
 5.5.7          IsGreaterEqual
 5.5.8          IsIBANChecksumValid
 5.5.9          IsLess
 5.5.10           IsLessEqual
 5.5.11           IsMemberOfGroup
 5.5.12           IsNotEqual
 5.5.13           IsOdd
 5.5.14           IsValidXml
 5.5.15           Not
 5.5.16           Or
 5.5.17           ValidateNPR
 5.6        Futurama Formulas - Table
 5.6.1          FindNextRow
 5.6.2          FindPreviousRow
 5.6.3          FindRow
 5.6.4          Sort
 5.6.5          VLookUp
 5.7        Futurama Formulas - Document
 5.7.1          CountErrors
 5.7.2          GetPathToDataFiles
 5.7.3          GetPortNumber
 5.7.4          GetRelativePathToDataFiles
 5.7.5          GetSessionID
 5.7.6          IsLicenceAvailable
 5.7.7          ReadError
 5.7.8          ReadIdentityProviderResult
 5.7.9          ReadRequestIP
 5.7.10           ReadRequestParameter
 5.7.11           ReadUserAgent
 5.7.12           ReadVersionNumber
 5.7.13           SessionTimeOut
 5.7.14           URL
 5.7.15           UserName
 5.8        Futurama Formulas - Conversion
 5.8.1          Convert.Excel.to.XML
 5.8.2          ConvertJSONtoXml
 5.8.3          ConvertTextToDate
 5.8.4          ConvertTextToNumber
 5.8.5          ConvertToBoolean
 5.8.6          ConvertToDouble
 5.8.7          ConvertToLong
 5.8.8          ConvertToString
 5.8.9          FormatDate
 5.8.10           FormatNumber
 5.8.11           Value
 5.9        Futurama Formulas - Matrix
 5.9.1          AddMatrices
 5.9.2          AddScalarToMatrix
 5.9.3          Cumulative
 5.9.4          CumulativeProductMatrix
 5.9.5          Distinct
 5.9.6          DivideMatrices
 5.9.7          DivideMatrixScalar
 5.9.8          DivideScalarMatrix
 5.9.9          Exponent
 5.9.10           First
 5.9.11           Floor
 5.9.12           If
 5.9.13           Index
 5.9.14           Inverse
 5.9.15           IsEqual
 5.9.16           IsGreater
 5.9.17           IsGreaterEqual
 5.9.18           IsNotEqual
 5.9.19           IsLess
 5.9.20           IsLessEqual
 5.9.21           Join
 5.9.22           Last
 5.9.23           Length
 5.9.24           MatrixProduct
 5.9.25           Max
 5.9.26           MaxScalarMatrix
 5.9.27           Mean
 5.9.28           Mid
 5.9.29           Min
 5.9.30           MinScalarMatrix
 5.9.31           MultiplyMatrices
 5.9.32           MultiplyMatrixVector
 5.9.33           MultiplyScalarMatrix
 5.9.34           Percentile
 5.9.35           PowerMatrix
 5.9.36           PowerMatrixScalar
 5.9.37           PowerScalarMatrix
 5.9.38           ReadMatrixFromXml
 5.9.39           Repeat
 5.9.40           Replace
 5.9.41           Reshape
 5.9.42           ReverseCumulativeProductMatrix
 5.9.43           ReverseMatrix
 5.9.44           Size
 5.9.45           Split
 5.9.46           SquareRootMatrix
 5.9.47           Step
 5.9.48           SubtractMatrices
 5.9.49           SubtractMatrixScalar
 5.9.50           SubtractScalarMatrix
 5.9.51           Sum
 5.9.52           Transpose
 5.9.53           UnitMatrix
 5.9.54           Vector
 5.10         Creating custom formulas in Futurama
 6      Futurama - Objects
 6.1        Action
 6.2        Aggregation
 6.3        Button
 6.4        ChangeValue
 6.5        CheckBox
 6.6        ClearCache
 6.7        DatabaseField
 6.8        DatabaseView
 6.9        DataTable
 6.10         DateBox
 6.11         DocConverter
 6.12         Document
 6.13         Download
 6.14         DropDownList
 6.15         EmailConverter
 6.16         ExcelConverter
 6.17         FileSaver
 6.18         FileUploader
 6.19         Fixed
 6.20         Formula
 6.21         GraphConverter
 6.22         HTMLInclude
 6.23         InterfacesNode
 6.24         LogMessage
 6.25         Navigator
 6.26         Node
 6.27         RadioButton
 6.28         RadioGroup
 6.29         Range
 6.30         Reference
 6.31         SubDocument
 6.32         TextBox
 6.33         UserTable
 6.34         UserVariable
 6.35         WebLabel
 6.36         WebListBox
 6.37         WebPage
 6.38         WebPanel
 6.39         WebReference
 6.39.1           WebReference - WCF Configuration
 6.40         WebService
 6.41         WebSlider
 6.42         WordConverter
 6.43         XmlBuilder
 6.44         XmlConverter
 6.45         XmlField
 6.46         XmlNode
 7      Futurama - Vision References
 7.1        Data
 7.1.1          ReadData
 7.1.2          WriteMessage
 7.1.3          GetPersonIdentifiers
 7.1.4          CreatePerson
 7.2        DataStore
 7.2.1          DeleteDataItem
 7.2.2          DeleteDataItemHierarchy
 7.2.3          DeleteDataItems
 7.2.4          GetDataItem
 7.2.5          GetDataItemHierarchy
 7.2.6          GetDataItems
 7.2.7          StoreData
 7.3        Accounts
 7.3.1          Activate Account
 7.3.2          Change Account
 7.3.3          Create Account
 7.3.4          GetQuestion
 7.3.5          GetQuestions
 7.3.6          Login
 7.3.7          ReadData
 7.3.8          ReinitializeAccount
 7.4        General
 7.4.1          TestConnection
 8      Futurama Vision
 8.1        Installation Futurama Vision
 8.1.1          Installation Futurama Vision Management Site
 8.1.2          Installation or Upgrade of the Futurama Vision Database
 8.2        Futurama Vision Management Site
 8.2.1          Futurama Vision Management Site - Admin
 8.2.2          Futurama Vision Management Site – Security
 8.2.3          Futurama Vision Management Site – Skinning
 8.2.4          Importing data into Futurama Vision
 8.2.4.1            Importing data by webservice
 8.2.4.2            Importing data from a Zip-file
 8.2.4.3            Importing data with Futurama Vision Batch
 8.2.4.4            Futurama Vision Webservice Security
 8.2.5          Further processing of data into Futurama Vision
 8.3        Futurama Vision File manager
 8.4        Activity overview
 8.5        Storing data in Vision from a Futurama application
 8.6        Futurama Vision – Data
 8.7        Futurama Accounts - Management Site
 8.7.1          Futurama Accounts - Table in Vision Database
 8.8        Futurama Server - Management Site
 8.8.1          Special Futurama Server Jobs
 8.9        Futurama Register - Management Site
 8.9.1          Configuration - Futurama Register
 8.10         Retrieving AppEvents from Futurama Vision
 8.11         Adding CustomPages to Vision
 9      Futurama Intermediate Control Output (FICO)
 9.1        FICO example - Change/Add HTML headers
 9.2        FICO example - Change Graph
 9.3        HTML5 Template
 10       Futurama Web API
 10.1         Postbacks of Futurama webcontrols
 10.2         Retrieving Resources using Web API
 10.3         WebAPI Session management
 11       Tutorials - Overview
 11.1         Tutorials - Examples and Downloads
 11.2         Beginners
 11.2.1           Creating formulas with Futurama
 11.2.1.1             Exercise 1: Pythagorean Theorem (Easy)
 11.2.1.2             Exercise 2: Newspaper stall (Medium)
 11.2.1.3             Exercise 3: Recursive functions (Difficult)
 11.2.1.4             Exercise 4: Leap Year (Difficult)
 11.2.1.5             Exercise 5: The Guessing Game I (Medium)
 11.2.2           Creating a Website Application
 11.2.2.1             Exercise 1: Creating a Website (Easy)
 11.2.3           Styling your website with CSS
 11.2.3.1             Exercise 1: Adding CSS (Easy)
 11.2.4           Adding interactivity to your website
 11.2.4.1             Exercise 1: Summation (Easy)
 11.2.4.2             Exercise 2: The Guessing Game II (Medium)
 11.2.4.3             Exercise 3: Nationality (Medium)
 11.2.4.4             Exercise 4: Nationality - RepeatTarget (Medium)
 11.2.4.5             Exercise 5: Reversed Guessing (Difficult)
 11.2.5           Working with Tables
 11.2.5.1             Exercise 1: Average (Easy)
 11.2.5.2             Exercise 2: Boundary values (Difficult)
 11.2.5.3             Exercise 3: Standard Deviation (Medium)
 11.2.6           Reading and processing XML-data in Futurama
 11.2.6.1             Exercise 1: Shares (Medium)
 11.2.7           Adding Graphs in Futurama
 11.2.7.1             Exercise 1: World Population (Easy)
 11.2.8           Working with Actions in Futurama
 11.2.8.1             Exercise 1: Changing Colors (Easy)
 11.2.8.2             Exercise 2: On and Off (Medium)
 11.2.8.3             Exercise 3: The ChangeValue object (Difficult)
 11.2.8.4             Exercise 4: The Guessing Game III (Medium)
 11.2.8.5             Exercise 5: CheckBox (Medium)
 11.2.9           Multiple Pages and Navigation
 11.2.10            Using XSLT to display data
 11.2.10.1              Exercise 1: Overview Summation (Easy)
 11.2.10.2              Exercise 2: Persons (Medium)
 11.2.10.3              Exercise 3: Leap Year Overview (Difficult)
 11.2.11            Webservices in Futurama
 11.2.11.1              Exercise 1: Example (Easy)
 11.2.12            Creating a Webservice Application
 11.2.12.1              Exercise 1: Add (Easy)
 11.2.12.2              Exercise 2: Webservice Nationality (Medium)
 11.2.13            Creating a Console Application
 11.2.13.1              Exercise 1: Adding extra fields (Easy)
 11.2.14            Generating Documents
 11.2.14.1              Exercise 1: Tax Rate (Medium)
 11.2.14.2              Exercise 2: Tax Rates Table (Difficult)
 11.3         Advanced
 11.3.1           Responsive Design
 11.3.1.1             Exercise 1: Orientation
 11.3.1.2             Exercise 2: Target different screen sizes
 11.4         Older Tutorials (Futurama Version 3.2)
 11.4.1           Futurama Editor Tutorial 1: The first sum
 11.4.2           Futurama Editor Tutorial 2: An annuity
 11.4.3           Futurama Editor Tutorial 3: Working with tables
 11.4.4           Futurama Editor Tutorial 4: Modelling a DB pension plan
 11.4.5           Futurama Editor Tutorial 5: Working with XML
 11.4.6           Futurama Web Tutorial 1: Hello world
 11.4.7           Futurama Web Tutorial 2: Buttons and Actions
 11.4.8           Futurama Web Tutorial 3: Textboxes
 11.4.9           Futurama Web Tutorial 4: DropdownLists
 12       Miscellaneous
 12.1         Responsive website
 12.2         Reducing memory usage for XmlNodes and XmlFields
 12.3         Explaining caching for websites and webservices
 12.4         Certificates - basic information
 12.5         Performance XML operations
 12.6         Creating XSD files and using them in combination with Futurama
 13       Templates
 14       Safe2Save WebAPI Sample
View  |  Print  |  PDF

451 documents found.


Text management and Multi-language

Developer
Futurama-Editor

Module: Editor

Version: 18.02 +

User: Developer

Object Type: Document

Description

Up to Futurama version 18.02 the text management of Futurama could be divided into two categories: text management outside the Futurama definition models (for example HTML-files and XSLT-files) and text management within the Futurama definition models. For the second category knowledge of the Futurama Editor, and building applications with this Futurama Editor was necessary in order to change texts. This also meant that setting up a multilanguage Futurama application took some time, and had to be done by a developer of the Futurama models. In Futurama version 18.02 functionality is added to read text resources from a resource document. This implies that text management for all the texts in a Futurama application can be done without any knowledge of building applications with Futurama. This makes it also very easy to make a Futurama application multi-language (see the paragraph “Multi-language”). At this page is explained how to set up a text resource document to be used in your Futurama application.

From Futurama release 19.03 onwards it is possible to use PageData in Futurama Output objects (i.e. HTMLInclude, Button, GraphConverter etc.). PageData is functionality that makes it possible to put dynamic content into HTML files or Futurama Output objects. Before, when you wanted to put dynamic content into HTML files you had to turn the HTML into an XSLT file. This conversion requires experience with XSLT. The use of PageData functionality also reduces the use of Action objects in your Futurama model, because you do not have to set dynamic texts of the Output object with an Action object anymore. For more information about PageData see the paragraph “Dynamic texts with PageData”.

Concept

Document properties

To use the text management functionality, there are two new properties that have to be defined within the Document (see the document page). The first property that has to be defined is the LanguageID. This property has to be a reference to an object of type long, such as a Fixed or a UserVariable. The latter is typically used in the situation of Multi-language where the user can change between languages. With this property the language is defined that is used for the text, where 0 is the first language, 1 is the 2nd language etc. For the second property, a ResourceDocument has to be defined. An example of the structure of such a ResourceDocument is given below. Here is also described how the texts can be defined within a ResourceDocument.

ResourceDocument

The ResourceDocument that is used within the Document, has to be an xml-file with a predefined structure. This doesn’t mean that the Resources have to be defined within xml, but have to be converted to the proper xml-structure in order to be used. It is for example possible to convert an Excel file to XML within Futurama (using the formula Convert Excel to XML) and then use an XSLT to convert this to the proper xml-structure. An example of this can be found below. The XML that is used as ResourceDocument has to have the next structure:

<?xml version="1.0" encoding="utf-8"?>
<ResourceManager xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.ActuIT.nl/DataTypes/Resources/">
	<languages>
		<arr:string>NL</arr:string>
		<arr:string>EN</arr:string>
	</languages>
	<resources>
		<Resources>
			<ResourceID>Title</ResourceID>
			<ResourceData>
				<translations>
					<arr:string>TitelNL</arr:string>
					<arr:string>TitleEN</arr:string>
				</translations>
			</ResourceData>
		</Resources>
		<Resources>
			<ResourceID>Weblabel</ResourceID>
			<ResourceData>
				<translations>
					<arr:string>Weblabel_NL</arr:string>
					<arr:string>Weblabel_EN</arr:string>
				</translations>
			</ResourceData>
		</Resources>
	</resources>
</ResourceManager>

Within the <languages> the different languages are defined that are used in the application. Below this, the resources are defined. For every text, a different section “Resources” is created. Within this section, the ResourceID is defined and the texts are defined for the different languages. Below, in the paragraph “Defining texts within Futurama”, the property ResourceID will be explained.

Within this example 2 different languages are used, Dutch and English. In the <languages> section at the top of the example, is defined that the texts with LanguageID 0 is Dutch and the texts with LanguageID 1 is English. If the LanguageID is 0, the first translation will be used. If the LanguageID is 1, the second translation will be used. Depending on the number of languages that are defined within this xml, the website can create the text. If only 1 language is used, the second string within <languages> and <translations> have to be deleted.

Defining texts within Futurama

When the text is created using a ResourceDocument, the texts, that are used in the Futurama Editor, have to be defined in a different way. The resources within the ResourceDocument are used for all the text properties within Futurama. With the ResourceDocument the text will be generated, depending on the LanguageID. Normally the text within, for example, a weblabel is defined as “Weblabel”. When using a ResourceDocument, the text definitions have to be changed. Instead of defining a text, a ResourceID from the ResourceDocument is used. When you want to use the Weblabel defined in the example above, you need to define the text property within the weblabel as follows: “{{Resource:Weblabel}}”. Depending on the LanguageID, the text of the Weblabel is now loaded from the ResourceDocument. When the LanguageID is 0, the text “Weblabel_NL” will be shown within the weblabel. When the LanguageID is 1, the text “Weblabel_EN” will be shown within the weblabel on the website.

It is also possible to define texts within a subdocument of a Futurama application. In this situation, it isn't possible to define a new resource document within the different subdocuments. The resources that are defined within the Futurama application will be used within all the subdocuments of this application.

Changing and testing texts

Once the structure of the ResourceDocument with texts is set, changes to this document can be made. For example adding another language, or change existing texts. Suppose you have a Futurama Website application and the structure of the ResourceDocument is used. When you open your Futurama application in your browser, Futurama will load the ResourceDocument in cache. This improves the performance of your application as Futurama does not have to load this document for each new request. However this also means that changes in the ResourceDocument are not immediately effected after replacing the old ResourceFile by a new one (as the version that is in cache will be used). Actually the new document is used after the application pool of your Futurama application is reset.

For developing purposes it is not desirable to reset the application pool for each change of the ResourceDocument. This can be prevented by using the ClearCache object within your Futurama document with the ResourceFile as TargetObject. Each time this ClearCache is executed the ResourceFile will be loaded again. Make sure you don’t execute the ClearCache each new session, but only at the moments you replace the ResourceDocument by a new version. This can be done by adding a parameter in the URL and read the value of this parameter using the ReadRequestParameter formula. The value of the parameter can be used as a condition on the ClearCache object. So only when this parameter is added in the url, or only when the value of this parameter is changed, the new ResourceDocument will be read. With this concept it is possible only to read the ResourceDocument again when you actually want to (when you replace the document by a new version).

Multi-language

Description

Using the text management with the ResourceDocument, it is easy to make a website multi-language. Within the ResourceDocument, the different languages and the resources that need to be used can be defined. When a new language has to be added to the website, only a new line needs to be defined at the languages and at the different resources that are used. Next to this, the LanguageID within the application will define which language to use.

Example defining paths

When using multi-language, you can also use a ResourceID to define the paths to different HTML or XSLT files. You can define the full path within the ResourceDocument, or define part of the path that is different between the languages.

Define full path:

“{{Resource:Path}}”

Define part of the path:

“data\{{Resource:Language}}\Introduction.html”

Define part of the file name:

“data\XSLT\Introduction{{Resource:Language}}.html”

LanguageID within XSLT

When a LanguageID is used within Futurama, this LanguageID can also be used within an XSLT file. Within the XSLT, the attribute @LanguageID is available. Within the XSLT, for example the text “<xsl:value-of select="@LanguageID"/>” can be used to get the LanguageID that is used. With this attribute, different texts can be defined within the XSLT for the languages that are used.

Resources within HTML

Resources can be used directly into an HTML file by simply replacing the text by “{{Resource:text}}”. Note that when the text is long, it might be considered to create separate HTML files, for the different languages, containing the text and use a ResourceID to refer to the proper HTML file.

Example

Example 1

Use an Excel file as ResourceDocument. Next, use an XSLT file to change it to the proper XML-structure.

Downloads

Download the files that are used for the example MultiLanguage.

Description

After downloading the file, follow the next steps:

  1. Create a local website application, using Futurama 18.02
  2. Extract the files from the zip-file and place them within this website

Within the zip-file, you will find an example Futurama web application, an Excel file and an XSLT file.

Within this application, the next steps are executed:

  • The formula Convert Excel to XML is used to read the Excel file with the resources and convert it to XML.
  • The converted Excel file isn’t the correct format yet and is converted with the provided XSLT file.
  • The XML that is made with the XSLT is used as ResourceDocument. And an UserVariable is used as LanguageID for the document.
  • On the website two buttons are made. The first button will change the LanguageID to 0 (Dutch) and the second will change the value to 1 (English).
  • Using the resources, the text of the title and weblabel are defined as described in the paragraph “Defining texts within Futurama”.
  • Depending on the LanguageID, the text of the title and weblabel is filled on the website.

Conversion

When making a new application, the procedures stated above can be followed right from the start regardless of the Futurama application to be unilingual or multilingual. In practice, however, there often already is an existing Futurama application. In this paragraph a step-by-step approach is presented that can be followed to convert an existing application into an application where all the text is defined outside the Futurama Document. Text management, including making the application multilingual, can then be done without any knowledge of building applications with Futurama.

Before commencing with the conversion it is recommended to review the example given above, especially for steps 1 and 2.

Creating the Excel file

As stated above the ResourceDocument containing all the texts has to be an XML file. It is also possible to use an Excel document instead and have it transformed to XML by Futurama. For most users Excel is more convenient to work with than XML. For this reason the latter approach is used in this step-by-step plan.

  1. Download the zip-file from the example. The Excel file ResourceDocument.xsls found in here serves as the basis for the ResourceDocument.
  2. Remove row 2 and 3, these texts are examples only. Don’t remove the first row.
  3. The Excel file is set up for two languages (NL and EN). If the application is unilingual, just remove column C.
  4. When converting the application all texts have to be replaced by ResourceID of the format {{Resource:<name of ResourceID>}}. Instead of needing to repeatedly type these texts it is possible to create an extra column in the Excel file that automatically composed the text to be copied. The Excel formula that can be used is “={{Resource:"&A2&"}}".
  5. Like the previous step, this step is also optional. In order to prevent duplicate ResourceIDs the Excel file can be extended with an extra column that counts the number of occurrences of every ResourceID in column A. The Excel formula COUNTIF() is typically suited for this: =COUNTIF(A:A;A2).
  6. Like the previous steps, this step is also optional. In order to prevent creating multiple ResourceIDs that contain exactly or nearly exactly the same text extend the Excel file with an extra column that counts the number of occurrences of every text. The Excel formula COUNTIF() is once again suited for this.

The Excel file, although still containing only the headers, is ready to be imported.

Importing and transforming Excel file to XML in Futurama

The next step is to import the Excel file into Futurama and transform it to XML. For this transformation the XSLT file ConvertResourceSheet.xslt is used. This file can also be found in the zip-file mentioned above.

  1. Follow the steps in the example to import the Excel file and transform it to XML. This has to be done in the Futurama Document that contains the objects that make up the website (such as the WebPages).
  2. A common way, though not the only one, of offering the choice between languages on a website is by a set of buttons (often with a flag) on which the user can click to choose a specific language. This method is also shown in the example. In the steps below it is assumed this method is also chosen.
  3. Make sure the properties LanguageID and ResourceDocument of the Document refer to the UserVariable containing the ID of the language and the XML resulting from the transformation of the Excel file respectively.

When importing an Excel file it is important to make sure that the Range in Excel which is referred to by the formula Convert Excel to XML contains all the data. Data that is not covered by the Range is omitted. It is also not allowed to have blank Cells in the Excel Range.

Now that the preparatory work has been done, the following steps explain how the several types of files containing texts as well as the texts defined in Futurama can be converted. Note that for a unilingual setting only the steps regarding the texts in Futurama Documents have to be executed; all other texts already exist outside Futurama.

HTML and XSLT files

HTML files are supportive files containing the HTML that will be rendered in the webapplication using HTMLInclude. XSLT files contain the definition of how XML data, generated by Futurama, is to be transformed into HTML using a XmlConverter which in turn will be rendered in the webapplication. The following steps explain first the approach that can be taken to convert these files in a multilingual setting.

There are in essence two approaches when it comes to HTML and XSLT files:

  1. For every file, the translation is added to the existing file. The upside is that the number of files will remain the same. The downside is that the contents of the resulting mixed files will be more difficult to interpret. For HTML files the ResourceID can be inserted into the HTML file itself (see the paragraph “Resources within HTML”).
  2. A copy is made of every file and the translation is performed in the copy. The downside of this method is that the number of files is essentially doubled. The upside is that a clear distinction is made between the languages, each file is far easier to translate and to interpret and no files have to be changed to another type.

In the following steps the second method is used. It is assumed that all HTML and XSLT files are located in subdirectories of a single directory “data”.

  1. In the main directory “data” make two new root-directories for each language e.g. “dataNL” and “dataEN”. Note that these names will be defined by a ResourceID.
  2. Copy all directories in the original “data”, except of course for “dataNL” and “dataEN”, into the new directories.
  3. Define in the Excel sheet a ResourceID (e.g. “rootpath”) with values “dataNL” and “dataEN” i.e. the names of the new directories.
  4. In the Futurama Editor replace in the property HTMLFileName of every HTMLInclude object the term ‘data’ by ‘data\{{Resource:rootpath}}’.
  5. In the Futurama Editor replace in the property XSLTFileName of every XmlConverter object the term ‘data’ by ‘data\{{Resource:rootpath}}’.

The only task remaining is to translate the text in the files in de directory “dataEN”.

Tooltips

Tooltips are texts or images that appear when hovering over or clicking on an element in a website. They are often connected to info-buttons. Tooltips containing fixed contents are usually defined outside Futurama, whereas tooltips that contain variable contents are often defined within the Futurama Document itself. The latter will be discussed below in the paragraph Text in Futurama document(s). Fixed tooltips are usually defined in a single JavaScript file e.g. tooltips.js. When tackling single files the following approach can be followed:

  1. Rename the file by adding a language extension to the name e.g. tooltipsNL.js
  2. Copy the file and change the language extension to e.g. tooltipsEN.js.
  3. Define in the Excel sheet a ResourceID (e.g. “extension” or “fileextension”) with values “NL” and “EN” i.e. the extensions of the new filenames.
  4. In the Futurama document search for the HTMLInclude object(s) that import the JavaScript file
  5. Add the ResourceID to the property HTMLCode. This will result in something like “………../tooltips{{Resource:extension}}.js”

The only task remaining is to translate the text in the new file.

Note that the ResourceID defined in step 3 can be used for all files, so it is often practical to use a generic name for this ResourceID. Note also that the approach followed here is not limited to JavaScript files (such as tooltips) but applies to all files. Another example are image files.

Images

Images are varied and range from a small arrow or a checkmark to webpage spanning background images, headers and buttons. When tackling images the approach to be taken depends on the number of images that have to be ‘translated’.

  • When there are only a limited number of images containing text that will have to be translated it is most convenient to just create a cousin and add an extension to it’s name, analogous to the approach followed by Tooltips.
  • When there are many images that need a translated ‘cousin’ it pays off to create a separate directory for every language, analogous to the approach followed by HMTL and XSLT files.

Templates

Templates are often stored in a single directory. The method for tackling HTML and XSLT files can therefore also be applied here. Unlike HTML and XSLT files however, the location of the templates is often stated in the <appSettings> section in the configuration file and read using the ReadConfigKey Formula. It is not possible to have a ResourceID in a configuration file. Instead the appSetting containing the main directory and  the ResourceID containing the rootpath can be concatenated inside the Futurama Document to compose the complete path to the template directory.

Note that this approach can be followed for all files whose location is defined in the configuration file.

Text in Futurama Documents

In a typical application a lot of text is already defined outside the Futurama Document. In addition there will also be text defined within the Document e.g. text on Buttons, WebLabels, HTMLIncludes, Graphs as well as text that is composed by Formulas. When tackling these objects the following steps can be followed:

  1. Work through one WebPage or Node at a time
  2. Select the WebPage/Node and then select Expand All. This will make sure no text is omitted because the object containing it is not visible.
  3. For every text that is encountered do the following:
  4. Add the text to the Excel file
  5. Create a ResourceID with a meaningful name e.g. “TitleHomePage”.
  6. Add the translation to the Excel sheet. If the translation is not yet known, add a dummy text.
  7. Replace the text in the Futurama Editor by the term {{Resource:xxx}} where xxx is the chosen name e.g. {{Resource:TitleHomePage}}
  8. Expand the Range in Excel to cover the newly created Resource.

When going through the entire Document it pays off to keep an eye for places where small changes to the model can save a lot of work:

  • WebLabel objects containing long texts are better replaced by an HTMLInclude object and the text defined in an HTML file.
  • Formulas that concatenate texts are often tedious to translate for they often contain many small texts that each has to be replaced by a ResourceID. Error messages are common examples of these kind of Formulas. A good alternative is to model the text in an XSLT file and to use an XmlConverter.

Dynamic texts with PageData

To use PageDate functionality you have to define an XmlBuilder where you put the elements for your dynamic content. ‘PageData’ has to be configured per ‘WebPage’ object that contains the Output object that you want to give dynamic values. In the property ‘PageData’ of the WebPage you have to set a reference to the XmlBuilder you defined.

To use PageData you have to define a string in the form of {{PageData:testString}}, where ‘testString’ is the name of an element from your XmlBuilder. Add {{PageData:testString}} to the property of the Output object and it will be replaced by the value of ‘testString’.

For example, you can apply PageData to the ‘Text’ property of a ‘Button’ (or other Output objects), but also to the properties ‘CssClass’ or ‘Tooltip’. PagaDate is added to HTML as follows:

     <p>

          Dynamic text in a external file: {{PageData:testString}}

     </p>

It is also possible to make a simple if-construction with PageData. You have to add an element to your XmlBuilder that returns a Boolean. For example:

     {{if:PageData:testCondition}}Value if True{{/if}}

Related Topics

- Document: Within the document, the LanguageID and ResourceDocument properties have to be defined.

- ClearCache: This object can be used to update the ResrouceFile that is used.

- Convert Excel to XML: This formula can be used to read an Excel file and use this file as ResourceDocument.

- HTMLInclude: The code or file name of this object can be changed using a ResourceDocument.

- XmlConverter: The text or path of this object can be changed using a ResourceDocument.

- DocConverter: The different text properties of this object can be changed using a ResourceDocument.

- GraphConverter: All the text property of this object can be changed using a ResourceDocument.

- WebLabel: The text property of this object can be changed using a ResourceDocument.

- Button: The text property of this object can be changed using a ResourceDocument.

- CheckBox: The text property of this object can be changed using a ResourceDocument.

- TextBox: The text property of this object can be changed using a ResourceDocument.

- RadioButton: The text property of this object can be changed using a ResourceDocument.

- UserVariable: The text property of this object can be changed using a ResourceDocument.

- Fixed: The text property of this object can be changed using a ResourceDocument.

- Formula: The text property of this object can be changed using a ResourceDocument.

- DataTable: The text property of this object can be changed using a ResourceDocument.

- WebPage: Within the WebPage, the PageData property has to be defined

- XmlBuilder: Within an Xmlbuilder you have to define the elements for PageData

Feedback

If you have any questions about this subject or if you want to provide us feedback please send us an e-mail.

Updated: 2019-03-12


Previous  |  Next