# Locale and keymap creation for ga_IE.UTF-8 environments



## Micil (Apr 5, 2018)

Before I start, I'm new to these forums. I've read the rules and the formatting guide but please be understanding if I get things wrong  I did a lot of Web searching and forum/tutorial reading before posting. Thread keymap-file-creation-for-turkish-f-layout.61460 covers similar ground, which is why I'm posting this under 'FreeBSD Development'. I haven't found anything to suggest that someone else has already done what I'm trying to do so I'm not reinventing the wheel as far as I can tell - I could be wrong though! I've tried to provide as much relevant information as possible.
I've used FreeBSD sparsely in the past but unfortunately it's never been an option for serious deployment, as a server or a desktop, because I have the following business requirements:

Availability of a *ga_IE.UTF-8* locale (ga = the Irish language; IE = Ireland). (This is an absolute requirement for console and desktop.)
Key mapping that provides certain textual characters (discussed presently), to support modern and traditional Irish orthography. (Absolute requirement for console and desktop.)
Fonts that have glyph support for these characters. (Absolute requirement for console and desktop.)
Full or partial Irish language user interface localisation. (Would be preferred but not a requirement, for either console or desktop.)
Functionality to fully and safely handle files and directories that have names which include these characters. (Absolute requirement for console and desktop.)
Functionality to fully and safely handle UTF-8-encoded text files. (Absolute requirement for console and desktop.)
Ubuntu (and other GNU/Linux distros no doubt) and Windows provide all of these out of the box and have done with years. (Some software packages on those platforms use fonts that lack glyphs for certain characters but I can usually work around this.) As far as I can tell, FreeBSD only provides some of them; and not necessarily by default. Please note that this _isn't_ a criticism: I realise that there are limited resources and orders of priority. Ubuntu in particular _is_ relevant to the question and I'll be coming back to it shortly. I've wanted to roll my sleeves up and see if I could get FreeBSD to do what I'd need it to do but I could never find the time until now.
I've played very briefly with the current version of TrueOS and it seems to meet at least some of my requirements. I've nothing at all against TrueOS, and intend to work more seriously with it in the future, but I wanted to see first if I could get the functionality I need from 'native' FreeBSD, using 'native' OS components and following 'native' FreeBSD conventions and standards. Following this, I'm mostly interested in the console / command line environment for the moment. If I can get things set up the way I want them there, I'll install Xorg and Lumina and see what happens next.
Anyway, I've managed to get quite a lot of what I need working but I've hit one or two brick walls. The following details the key points of what I've achieved so far, and includes specific brick wall-related questions. I'd be grateful if anyone could tell me if I'm after doing anything wrong, and if they could answer any of the questions.
Prep work 1: install FreeBSD
Created an installation disc from the 11.1 amd64 ISO.
During installation, which was onto a Dell Latitude, selected:

United Kingdom ISO-8859-1 system console driver (to get the nearest thing available to an Irish keyboard layout)
Region - Europe
Country - Ireland
Created no additional users (so all my testing to date has been as root only)
After installation, ran:

`freebsd-update fetch && freebsd-update install && shutdown -r +0`
After restart, ran:

`pkg update && pkg upgrade && pkg install vim && shutdown -r +0`
After restart:

Enabled automounting of external storage following guidance given in the handbook.
As part of this, following guidance given in the fora, I edited /etc/auto_master as follows: 
	
	



```
/media        -media        -nosuid,noatime,-L=ga_IE.UTF-8
```
.
I did this to allow the system to handle non-ASCII characters in file/directory names on automounted media. The system doesn't actually have a *ga_IE.UTF-8* locale of course - but it will in a minute 
At this point:

`freebsd-version` returned 
	
	



```
11.1-RELEASE-p8
```
.
`locale` returned 
	
	



```
LANG=
```
, 
	
	



```
LC_ALL=
```
, with all other items 
	
	



```
=C
```
.
`locale -a` returned a list that included 
	
	



```
en_IE.UTF-8
```
.
Prep work 2: switch globally to the vt console
As I understand it, *syscons* has no UTF-8 support but *vt*/*newcons* has.
In the file /boot/loader.conf, I added the following line to enable *vt* on boot:

```
kern.vty=vt
```
While I was at it, I set the console font to a size more suited to the test machine's screen by adding the lines:

```
hw.vga.textmode=1
i915kms_load="YES"
kern.vt.fb.default_mode="1366x768"
```
I saved all this, then ran `shutdown -r +0`.
Requirement 1: create a ga_IE.UTF-8 locale and enable it globally
I recursively copied the directory /usr/share/locale/en_IE.UTF-8 to /usr/share/locale/ga_IE.UTF-8.
Of the contents of these directories, only LC_MONETARY and LC_TIME are actual text files.
The rest are symlinks to files in /usr/share/locale/en_US.UTF-8, and were copied as such.
In /usr/share/locale/ga_IE.UTF-8:

LC_MONETARY: No changes were needed.
LC_TIME: Changes were needed (day- and month name strings) and I translated as appropriate (file attached).
In the file /etc/login.conf, under 
	
	



```
default:\
```
, and being careful with the final trailing slash, I added the lines:

```
:charset=UTF-8:\
:lang=ga_IE.UTF-8:
```
In the file /etc/profile, following guidance given at cooltrainer.org, I added the lines:

```
LANG=ga_IE.UTF-8;   export LANG
CHARSET=UTF-8;  export CHARSET
```
Then I ran `cap_mkdb /etc/login.conf && shutdown -r +0`.
After the restart:

`locale` now returns *ga_IE.UTF-8* as values for everything except 
	
	



```
LC_ALL=
```
 (which has no value).
The output of `ls -hl` now includes the localised time strings provided by me.
The output of `date` does the same.
Vim now returns console messages in Irish localisations, none of which were provided by me. Presumably, the Vim package comes with a number of its own localisations.
Listing of files/directories with non-ASCII characters in their names, including those located on automounted external FAT32 media, basically works but some characters clearly lack glyph support in the default console font (see Requirement 3, below).
Question 1: So my homebrewed *ga_IE.UTF-8* locale seems to be up and running. But have I it built the right way? Have I missed anything?
Requirement 2: create an Irish keymap file and make it the global default
I didn't want to reinvent more of the wheel than I had to so I looked at how Ubuntu and TrueOS provide this functionality. If I've understood correctly, both use a keyboard mapping file written by Séamus Ó Ciardhuain for Xorg.
Ó Ciardhuain's mappings support characters essential to modern and traditional Irish orthography, along with characters of the Early Medieval Ogham alphabet. For the moment at least, I intend to focus only on the modern and traditional orthographic characters. Once I get all these working I might look into creating a separate 'native' FreeBSD keymap for Ogham.
Ó Ciardhuain's mappings use *Alt Gr* as either a modifier- or a dead key. In some cases *Shift* and *Caps Lock* further modify the output.
In Ubuntu, the mapping file, named simply ie, is located in /usr/share/X11/xkb/symbols.
Even in plain vanhilla Ubuntu server, without X having been explicitly installed, this part of the directory tree's present, as is the ie file.
I don't have a note of the path to hand, but I found that TrueOS has a copy of the same file in a similar location.
I found that in FreeBSD without Xorg installed, that particular branch of the directory tree doesn't exist. Nor does anything similar to it and nor does the ie file.
After I ran `pkg install xorg` though, I found that /usr/local/share/X11/xkb/symbols now existed and that it contained the ie keymap file, along with others.
But because I want to implement an Irish keymap 'natively' in FreeBSD, I chose not to look into Xorg functionality. Rather, I looked at how to duplicate Ó Ciardhuain's mappings as faithfully as possible but without the need to install Xorg (or bits of it).
I ran `kbdcontrol -d > /usr/share/vt/keymaps/ie.acc.kbd` to make a keymap file that duplicated the UK keymap.
In the file /usr/share/vt/keymaps/INDEX.keymaps I then added the line 
	
	



```
ie.acc.kbd:en:Ireland (accent keys)
```
 just above the line 
	
	



```
it.kbd:en:Italian
```
. Then I restarted the machine.
I used the *xx.acc.kbd* naming convention because Ó Ciardhuain's mappings include several dead keys, which I think are the same thing as 'accent keys' although I might be wrong. The intention was to develop an Irish keymap by 'overlaying' Ó Ciardhuain's Irish mappings onto the UK keymap and leaving everything else alone. In this way, mappings for characters relevant to Irish orthography would be consistent across Ubuntu/Linux, TrueOS and 'native' FreeBSD. But in FreeBSD all other mappings would remain in their 'native' state, rather than possibly imposing 'X-isms' or 'Linux-isms'.
I've completed the first version of my keymap file (file attached) and tested it thoroughly. A lot of the mappings work as expected but quite a few don't. All but two of the failed mappings concern dead/accent keys, although several of the dead/accent keys are working perfectly.
Note that at this point, I'm only interested in fixing keymappings that aren't working. Key mappings that actually _do_ work but which lack requisite font/glyph support are a different matter entirely, and are addressed under Requirement 3, below.
For these purposes, I strictly define 'working' as 'does exactly what Ó Ciardhuain's mappings do'. In the case of dead/accent keys, this isn't always intuitive, at least to me. For instance, on Ubuntu, the *Alt Gr + 6* dead key combination (dead circumflex) puts a circumflex on certain alphabetic characters but causes all the numeric ones, along with - and +, to output the superscript version of the character. Similarly, *Alt GR + v* (dead caron) causes the numerics, along with - and +, to output subscript versions.
The following (html entity and key combinations given in brackets) is the only one of Ó Ciardhuain's modifier key mappings that I can't get to work:

Non-breaking space (&#x00A0;) (*Alt Gr + Space* or *Shift + Alt Gr + Space*). (Funny enough, the inverted exclamation mark (&#x00A1;) works fine.)
And the following (key combinations given in brackets) are the non-working dead/accent key mappings:

dcir - dead circumflex - numerics (*Alt Gr + 6* followed by 0, 4, 5, 6, 7, 8, 9, - or =)
dcir - dead circumflex - Caps Lock off (*Alt Gr + 6* followed by c, g, h, j, s, w, y or z)
dcir - dead circumflex - Caps Lock on (*Alt Gr + 6* followed by c, g, h, j, s, w, y or z)
dtil - dead tilde - Caps Lock off (*Alt Gr + n* followed by =, e, y, u, i or v)
dtil - dead tilde - Caps Lock on (*Alt Gr + n* followed by =, e, y, u, i, o, a, v or n)
ddot - dead dot above - dot above only (*Alt Gr + w* followed by spacebar)
ddot - dead dot above - Caps Lock off (*Alt Gr + w* followed by a, b, c, d, e, f, g, h, i, j, l, m, n, o, p, r, s, t, w, x, y or z)
ddot - dead dot above - Caps Lock on (*Alt Gr + w* followed by a, b, c, d, e, f, g, h, i, j, l, m, n, o, p, r, s, t, w, x, y or z)
ddot - dead dot above - dot above only (*Alt Gr + h* followed by spacebar)
ddot - dead dot above - Caps Lock off (*Alt Gr + h* followed by a, b, c, d, e, f, g, h, i, j, l, m, n, o, p, r, s, t, w, x, y or z)
ddot - dead dot above - Caps Lock on (*Alt Gr + h* followed by a, b, c, d, e, f, g, h, i, j, l, m, n, o, p, r, s, t, w, x, y or z)
ddia - dead diaeresis - Caps Lock off (*Alt Gr + 8* followed by h, t, w or x)
ddia - dead diaeresis - Caps Lock on (*Alt Gr + 8* followed by h, t, w, x or y)
drin - dead ring above - Caps Lock off (*Alt Gr + k* followed by u w or y)
drin - dead ring above - Caps Lock on (*Alt Gr + k* followed by u)
dced - dead cedilla - Caps Lock off (*Shift + Alt Gr + \* followed by d, e, g, h, k, l, n, r, s or t)
dced - dead cedilla - Caps Lock on (*Shift + Alt Gr + \* followed by  d, e, g, h, k, l, n, r, s or t)
dcar - dead caron - caron only (*Alt Gr + v* followed by spacebar)
dcar - dead caron - numerics (*Alt Gr + v* followed by 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - or =)
dcar - dead caron - Caps Lock off (*Alt Gr + v* followed by a, c, d, e, g, h, i, j, k, l, n, o, r, s, t, u, v or z)
dcar - dead caron - Caps Lock on (*Alt Gr + v* followed by a, c, d, e, g, h, i, j, k, l, n, o, r, s, t, u, v or z)
*Notes about ddot:*

Dead caron is the first of two accent/dead keys where nothing at all works.
Note also that the alphabetics listed above are the only ones that produce output using Ó Ciardhuain's mappings.
Using Ó Ciardhuain's mappings on Ubuntu, *Alt Gr + w* or *h* followed by i (Caps Lock off) outputs Latin small letter dotless i (&#x0131;).
Using Ó Ciardhuain's mappings on Ubuntu, *Alt Gr + w* or *h* followed by i (Caps Lock on) outputs Latin capital letter i with dot above (&#x0130;).
Using Ó Ciardhuain's mappings on Ubuntu, *Alt Gr + w* or *h* followed by j (Caps Lock off) outputs Latin small letter dotless j (&#x0237;).
Using Ó Ciardhuain's mappings on Ubuntu, *Alt Gr + w* or *h* followed by j (Caps Lock on) outputs nothing.
Using Ó Ciardhuain's mappings on Ubuntu, *Alt Gr + w* or *h* followed by l (Caps Lock off) outputs Latin small letter l with middle dot (&#x0140;).
Using Ó Ciardhuain's mappings on Ubuntu, *Alt Gr + w* or *h* followed by l (Caps Lock on) outputs Latin capital letter l with middle dot (&#x013F;).
*Notes about dcar:*

Dead caron is the other accent/dead key where nothing at all works.
Note also that the alphabetics listed above are the only ones that produce output using Ó Ciardhuain's mappings.
Using Ó Ciardhuain's mappings on Ubuntu, *Alt Gr + v* followed by v (Caps Lock off) outputs Latin small letter u with diaeresis and caron (&#x01DA;).
Using Ó Ciardhuain's mappings on Ubuntu, *Alt Gr + v* followed by v (Caps Lock on) outputs Latin capital letter u with diaeresis and caron (&#x01D9;).
Question 2a: I've tried various decimal and hex codes, always running `kbdcontrol -l /usr/share/vt/keymaps/ie.acc.kbd` after making changes to ie.acc.kbd, but for the key mappings listed above I just can't get anything to work: I either get the wrong character, no character at all or a beep. It isn't a permissions problem: changes in the file produce consistent changes in key outputs. Values in the attached file correspond to decimal HTML entity ones. Can anyone tell me what I'm doing wrong?
Question 2b: I'm certain there's more to be added to INDEX.keymaps but I wasn't sure if I'd end up breaking something. The one line I did add allowed me to proceed with developing the keymap so I left it at that for the time being. What do I need to do to 'complete' modification of INDEX.keymaps? Did I put the one liner in the right place?
Requirement 3: get requisite font/glyph support
It appears that the following characters (html entities given in brackets) _are_ working but that the default *vt* console font has no glyphs for them:

Tironian et (&#x204A;)
Latin small letter r with long leg (&#x027C;)
Latin small letter long s with dot above (&#x1E9B;) (Interestingly, the un-dotted Latin small letter long s (&#x017F;) is working fine.)
Approximately equal to (&#x2245;) (This isn't an Irish orthographic character but it is supported by Ó Ciardhuain's keymap.)
Upper- and lowercase latin letter b with dot above (&#x1E02; and &#x1E03;)
Upper- and lowercase latin letter d with dot above (&#x1E0A; and &#x1E0B;)
Upper- and lowercase latin letter f with dot above (&#x1E1E; and &#x1E1F;)
Upper- and lowercase latin letter m with dot above (&#x1E40; and &#x1E41;)
Upper- and lowercase latin letter p with dot above (&#x1E56; and &#x1E57;)
Upper- and lowercase latin letter s with dot above (&#x1E60; and &#x1E61;)
Upper- and lowercase latin letter t with dot above (&#x1E6A; and &#x1E6B;)
Question 3: Is there a font with support for these characters already installed anywhere on the system? If so, is it compatible with *vt* and what's the correct way to get *vt* to use it? If not, where can I get a suitable *vt*-compatible font? (There are very few fonts under /usr/share/vt/. I tried gallant but _it_ hadn't the requisite glyphs either.) I've never even played with typography and font creation/modification but I'd consider homebrewing my own if there's no other option.
Requirement 4: full or partial Irish language user interface localisation
Don't really want to think about that for now. Unless the number of strings that have to be translated to support CLI environments is fairly small I doubt I'd have the time.
Question 4: Maybe it _is_ fairly small? Could anyone tell me roughly how many words would have to be translated?
Finally
Question 5: Other than any actual mistakes I've made, have I missed anything?
Any help would be greatly appreciated.


----------

