At System → Administration → Language support → Text. I can only choose standard locales, but I would like to fine-tune. For example in Windows I could customise things like time and date format, measure units, decimal separator, currency, etc manually - how can I do this in Ubuntu?
This answer will demonstrate how to fully customize a locale, optionally using an existing locale as a base. The type of locale that will be used in this answer is the
Find a guide
The first thing you need to customize a locale, is get to know the format of the locale. This web locale editor has a comprehensive description of every field in a locale, despite not being usable by just anyone in a right-away manner. This will be the guide to use.
The only tools you need to work with locales are
I recommend you to create a directory and save everything related with the work you will do on the locale to it.
Text-to-unicode converter (encodestr)
NOTE: if you are using non-common characters you may have problems with the script I write below; you might want to take a look at the alternative scripts linked by nass.
Save the following code to a file. This file will be identified by your system as a python script, which is alright because it is one. This guide assumes you called the script
After you have saved it, give the file execution permission - this will come in handy. You can do that using nautilus, or by running from a terminal the following command, on the directory in which you saved the script:
You can now test this script by running on the same directory:
Modify an existing locale
Modifying an existing locale is the easiest case, as ideally you will pick a locale that fits your needs almost totally, in which case you need to make only small modifications. To tailor it, you can use the guide to know which of the sections are the ones you want to change, and how you can change them. All the installed locales reside in
However, the first thing you will notice when you open a locale is that you will read english words as much as weird
When you know which sections you have to change, you need to know each field contained in the section.
Now that you know which fields to modify, use the guide again to find out what values does the field accept.
Just when you know what to write on the fields you want to modify, run the text through the
NOTE: Not every field needs to be encoded, use an existing locale as a reference if needed.
After you have modified every field you wanted to, you will need to proceed to install the locale to the system, so it can be used. Proceed to the installation section for this.
Creating a locale from scratch
As opposed to modifying one, the other method you can use to create your custom locale is working on it from scratch. This is not very difficult if - again - you use the guide. Here's a useful tip though: you can copy sections from other locales without actual copy and paste methods. You just have to follow this format:
Installing your custom locale
The steps I am going to show below may not be optimal, but work.
NOTE: If you want to use one locale for every locale setting, write
You have finished
The next time you log in, your locale should be in use. You can test this by running the
Please comment about inconsistencies or false statements in this guide!
Not sure what kind of customization you want, but you can set some locale variables using your
Generating custom locales is also possible. See e.g. this guide for dates.