Adding new transliteration layouts to
toCyrillic extension

New layouts can be added via the configuration editor. Type in about:config in the location field. Once the editor loads, filter the preferences by tocyrillic to see only those that apply.

Two prefs need to be added for each layout.

The first one is the array containing the conversion table. It is loaded into the program using javasrcipt eval function, and is therefore expected to be in proper javascript array literal format, with all special characters properly escaped.

Designate a new name to your layout - a word without spaces, for example mynewlayout Create a new string preference extensions.tocyrillic.layouts.mynewlayout

The general format of the conversion table is this: [ [translit string, cyrillic string], [translit string, cyrillic string], ... [caseless translit string, cyrillic character, guess-case], ... ]

The strings can be specified either literally or using unicode sequences. For example: [["b", "Б"],["u", "\u0423"],["f", "\u0424"],["``", "\u042A"],["`", "\u044A", true]]

Each subarray contains the latin string to be converted (more than one character if needed), the cyrillic string to convert it to (also more than one character if needed, though this is expected to be used rarely), and, optionally, a guess-case flag.

If the latin string is not caseless (the results of conversion with toUpperCase() or toLowerCase() are not the same), the 3rd parameter is ignored, and the case of the resulting cyrillic sequence is determined from input. If the source string is caseless, for example a quote or pound character, then capitalization can be guessed depending on context. If the guess-case flag is true, the case will be upper if the surrounding letters are in upper, and lower otherwise. If guess-case is false or not present, the cyrillic string will be treated literally, without any case conversion.

The latin or cyrillic strings do not need to be unique. If there are duplicates, converter will use the first instance it sees. Therefore, if your table contains ["ya","Я"],["ja","Я"], both "ya" and "ja" will be converted to "Я" on the way from latin to cyrillic. On the way back "Я" will become "ya". Similarly, if you specify ["y","Й"],["y","Ъ"], "y" will convert to "Й", and on the way back both "Й" and "Ъ" will become "y". Of course this particular case makes round-trip conversion impossible, so some additional combinations are necessary.

Once the array is assembled, put it into your new preference in configuration editor.

The second pref is the label for your new layout. Create a new string preference extensions.tocyrillic.layouts.mynewlayout.description and put in something descriptive. This is the string that will show up in layout drop down on the ToCyrillic Options dialog.

Once both prefs are created, open the options dialog, found in the Tools menu, or in the context menu of the extension in the extension manager. Switch to layout tab and choose your layout. Hit apply and try it out in the text field below the drop-down. If, for any reason, the layout fails to load, you'll find some message in the javascript console.