82.6 F
Tampa
Thursday, June 8, 2023
spot_img
spot_img

Localization in FileMaker | DB Services

Date:

Localization can be described as the process of adapting your application to better fit the language and culture of the end users. Making it easier for the users to understand and use an application is integral to an effective workplace. There are many ways of integrating localization into your application. One of the most basic but important ways is enabling users to choose the language of the application. Let’s explore one way to achieve this in Claris FileMaker. Includes a video and sample file.

Application

To demonstrate this functionality, we’ll use a small application for the data entry of products. You can download the application from this article (located at the end of the article) and follow along.

Filemaker localization app demo page

As you can see, the user interface is currently in English. Let’s head over to the “Setup” tab
and see what options our users have.

Filemaker localization english dictionary setup

From the Setup screen, the users get access to the application’s UI dictionary. From here, one can set different keywords and specify the values in the languages supported. Usually, this setup window is reserved for admin users or developers, as changes made here will
affect the entire application. 

When a new record is created, the users can enter any value they want as the key. This
value needs to be unique, or else it will change the other value that has the same key.
Then enter the values for the different languages. The yellow dot on the left indicates that
this record has not been synched into the system yet.

Filemaker localization empty dictionary record

Once the values have been entered, click the “Update” button, and the values will synchronize in the system. The dot on the left will change to green to indicate that the value is ready to use.

Filemaker localization filled dictionary record

Users can also change their preferred language with the dropdown on the top-right. This
will immediately change the language of all the UI features of the application.

Filemaker localization spanish dictionary page

How Does It Work? 

Let’s take a look at how this works. This system has three core parts: 

  • A global JSON variable generated upon opening the file 
  • A custom function to get the labels in the correct language 
  • Using button bars as labels to allow us to change their values 

The Global Language JSON

In order to allow access to the values to all layouts, a global JSON object is generated
when the file is first opened. Here’s a shorter version of the JSON generated.

{
"language" : "English",
"dictionary" :
{
"sync" :
{
"English" : "Sync",
"Spanish" : "Sincronizar"
},
"testText" :
{
"English" : "Test text",
"Spanish" : "Texto de prueba"
},
"userName" :
{
"English" : "Username",
"Spanish" : "Nombre de Usuario"
}
}
}

As you can see in the JSON, we save the language that is selected and a dictionary of the
records. We can go ahead and get the value that we need by grabbing the value of the key
at the selected language. 

FileMaker has excellent support for working with JSON data, so creating this JSON object
is fairly simple. Here’s the script used to generate it.

Filemaker localization script create language json

And here is a closer view at the Set Variable step on line 17:

JSONSetElement ( $$languageJSON ;
["dictionary." & DICTIONARY::key & "." & "English";
DICTIONARY::englishValue ; JSONString];
["dictionary." & DICTIONARY::key & "." & "Spanish";
DICTIONARY::spanishValue ; JSONString]
)

The Custom Function

This custom function is a way to make it more convenient for the developer to use the functionality throughout the system. It is in charge of querying the JSON object for the value of the specified key on the currently selected language.

//Name: getLanguage(key)
//Parameter: key
Let(
[
vLanguage = JSONGetElement($$languageJSON; "language");
vPath = "dictionary." & key & "." & vLanguage;
vValue = JSONGetElement($$languageJSON; vPath)
];
vValue
)

A sample call to this function would look like this:

getLanguage("nameLabel")

Button Bars as Labels

Using a button bar with a single segment as a label, we can dynamically set the displayed text. In our case, we make a call to our custom function to get the value we want in the correct language.

Filemaker localization button bar label
Filemaker localization button bar label settings

Updating the JSON Object

There are two situations that we want to handle:

  1. New values
  2. Updated values

One simple way to handle both of these cases is to simply create the JSON Object again when new values are added or updated. To do that, we simply attach the script that creates the JSON to the “Sync” button.

Filemaker localization update button script settings
Filemaker localization button script pick window

The creation of the JSON is quick enough that remaking it won’t really affect the application’s performance. 

Conclusion 

Localization is very important when your application is used by people speaking different
languages . One very important aspect of localization is adding the ability for
users to change the language of the application. We demonstrated how to do this by creating a
global dictionary with the labels for the application and making a custom function to
query values. We also used button bars as labels as they support dynamic labels. 

If you would like to learn more about localization in FileMaker or explore possible ways in
which localization can make your business more effective, contact our team at DB
Services
 and we’ll gladly help you find the best solution for your business.

Did you know we are an authorized reseller for Claris FileMaker Licensing?
Contact us to discuss upgrading your Claris FileMaker software.

Download the FileMaker Localization File

Please complete the form below to download your FREE FileMaker file.

DB Services
DB Serviceshttps://dbservices.com
FMT's PREFERRED DBServices expert developers are able to tackle any project, whether you need guidance on a small project or want to outsource a large initiative to us. You will work with a reliable team that has the talent and experience to solve any challenge, and a culture designed around excellent customer service and building lasting relationships. Our mission is to make organizations more efficient and effective through digital transformations while offering superior service and exceptional expertise.

Share post:

crm erp
crm erp

Popular

More like this
Related

DevOps Essentials: Adopting Source Control

In this second episode of the DevOps Essentials, we...

Discussing FileMaker Hosting & Soliant.cloud with Thought Leaders

https://www.youtube.com/watch?v=IEVz-UA-RuA Bill Heizer and Adam Russ with Soliant Consulting sit...

FileMaker Data Exports with RESTful APIs & JSON Data Contracts

In today’s rapidly evolving digital landscape, businesses rely heavily...