How to Copy Locale Settings from One FileMaker App to Another

Oops, I Messed Up the Locale Settings of My App

A few weeks ago, I used the latest version of the FileMaker Data Migration Tool (FM DMT) to do a deployment. As a chaos monkey myself, I added the -target_locale parameter to my command line and set it to “System” and thought it would keep the locale setting the same.

Silly me. It turned out that the value “System” doesn’t mean keeping the locale setting the same. It means using the locale setting of the operating system where the data migration occurs and giving it to the target file. Hence the name “System”. Duh.

By the way, if you don’t want to change your locale settings during data migration, don’t use the -target_locale parameter in your FM DMT command.

Anyway. I messed up. How do I get my file’s locale setting back to what it was?

Locale Settings Contain More Than One Attribute

When FileMaker 19.5 was released, Claris introduced an enhancement to the FM DMT by allowing developers to use a new parameter -target_locale to change the target file’s locale setting. When I read the documentation, I saw a list of supported values.

Supported names for the target_locale parameter

Somehow, this gave me the impression that the locale setting is just one parameter represented by a single value (Language).

So, my immediate thought on how to restore the locale setting of my file was to run the DMT again. But this time, set the -target_locale parameter to “English.” My app serves English-speaking users and runs on a machine with English chosen as the system language. So this has to give me what I need, right?

Wrong again.

As you probably have realized, the same language can be spoken by people from different countries, who might have different preferences when it comes to many things, such as

  • Which day is considered the 1st day of the week (Sunday or Monday)?
  • What abbreviation do you call the day of the week, month or quarters?
  • What date format to use
  • What character is used as the thousand delimiter (if at all)?
  • Metric or Imperial?
  • 12h or 24h?
  • And so many more…

There’s so much nuance to locale settings. It’s impossible to express all these nuances using a single value. What Claris listed in the documentation is a list of pre-configured settings that we could use as a template. But in my case, to restore my app’s locale setting to exactly what it was, I must know what each setting used to be.

So how do I do that?

Extract Locale Settings from a FileMaker File and Save

There’s an easy way to extract locale settings from an FM file. All I need to do is use the function Get ( FileLocaleElements ) on a backup of my original file to extract that file’s locale setting.

Do not confuse the function Get ( FileLocaleElements ) with the function Get ( SystemLocaleElements ). I need the former because the target setting I want is in a file. If an operating system perfectly captures the target setting you need, use the latter to capture it.

When I use the function Get ( FileLocaleElements ), I get a JSON response. As we suspected, it contains a LOT of information:

{
	"APIVers" : 1,
	"Currency" : 
	{
		"Leading" : true,
		"Symbol" : "$"
	},
	"Date" : 
	{
		"DMQ" : 
		{
			"1stDayOfWeek" : 1,
			"DaysOfWeek" : 
			{
				"AbbrvList" : 
				[
					"Sun",
					"Mon",
					"Tue",
					"Wed",
					"Thu",
					"Fri",
					"Sat"
				],
				"NameList" : 
				[
					"Sunday",
					"Monday",
					"Tuesday",
					"Wednesday",
					"Thursday",
					"Friday",
					"Saturday"
				]
			},
			"Months" : 
			{
				"AbbrvList" : 
				[
					"Jan",
					"Feb",
					"Mar",
					"Apr",
					"May",
					"Jun",
					"Jul",
					"Aug",
					"Sep",
					"Oct",
					"Nov",
					"Dec"
				],
				"NameList" : 
				[
					"January",
					"February",
					"March",
					"April",
					"May",
					"June",
					"July",
					"August",
					"September",
					"October",
					"November",
					"December"
				]
			},
			"Quarters" : 
			{
				"AbbrvList" : 
				[
					"Q1",
					"Q2",
					"Q3",
					"Q4"
				],
				"NameList" : 
				[
					"1st Quarter",
					"2nd Quarter",
					"3rd Quarter",
					"4th Quarter"
				]
			}
		},
		"DateNums" : 
		{
			"0d" : true,
			"0m" : true,
			"YYyy" : true
		},
		"DateOrderID" : 2,
		"DateOrderName" : "YMD",
		"Sep" : "-",
		"YMD" : 
		{
			"ElementArray" : 
			{
				"NameList" : 
				[
					"M-$",
					"YYYY#"
				],
				"SepList" : 
				[
					"-",
					"-"
				]
			},
			"MustUseLocalesSep" : false
		}
	},
	"LocaleID" : 
	{
		"IDNum" : 21,
		"IDStr" : "English",
		"ISOLangCode" : "en",
		"LID" : "English",
		"Name" : "English"
	},
	"Misc" : 
	{
		"Active" : false,
		"Metric" : true
	},
	"Num" : 
	{
		"1000s" : " ",
		"Decimal" : ".",
		"Lead0" : true
	},
	"Text" : 
	{
		"SQuotLead" : "“",
		"SQuotTrail" : "”",
		"Sep" : " "
	},
	"Time" : 
	{
		"12h" : false,
		"HMS" : 
		{
			"0h" : true,
			"24h" : "",
			"Seconds" : false
		},
		"NightDay" : 
		{
			"12hSuffix" : true,
			"amStr" : "",
			"pmStr" : ""
		},
		"Sep" : ":"
	}
}

To capture it, copy and paste this JSON into a text file and save it. Let’s say I named this file target_locale_setting.txt.

Apply Locale Settings Using the Saved Extract

Now that I have extracted the settings from my original FM app and captured them in target_locale_setting.txt, I want to apply them to my new FM app.

To do so, I need to use the FM DMT with the -target _locale parameter again. If you need help learning the basics of FM DMT, check out our tutorial video.

This time, rather than specifying the value “System” or using any of the supported language values, I specified a file path pointing to target_locale_setting.txt that contains the desired settings. Something like this:

FMDataMigration -src_path <my source file path>
 -src_account <my source file account>
 -src_pwd <my source file password>
 -clone_path <my clone file path>
 -clone_account <my clone file account>
 -clone_pwd <my clone file password>
 -target_path <my target file path>
 -target_locale "C:\DMT\target_locale_setting.txt"

This tells the FM DMT instead of using the operating system’s setting or any of the pre-configured settings, use the exact settings specified in the .txt file that I specified. Given the .txt file contains the locale settings from my original app, this will essentially copy that setting into the new app.

Conclusion

As convenient as the ability to specify the target locale with FM DMT is, it’s certainly an intricate feature that should be used with caution (don’t make the same mistake I did). Know that your FM app’s locale setting is a collection of many attributes that can be extracted using the Get ( FileLocaleElements ) function. In addition, with FM DMT, besides all the pre-configured settings (represented by languages), you can specify the exact locale settings in the JSON format using a text file.

If you have more questions about FileMaker data migration or FileMaker deployments, please contact us.