Struggling with Taxonomy in CSOM

The parts of the CSOM for updating Taxonomy fields are really cumbersome. I mean, look at this code, nicely provided by Vadim Gremyshev (@vgrem). To set a value in a taxonomy field we have to assemble a text representation, and adding a “fake” lookup id.

What is needed is a wrapper for handling Taxonomy fields. SPMeta2 and PnP don’t seem to have it yet.

Another issue that I have struggled with today was the missing Microsoft.SharePoint.Client.Taxonomy.dll. If you see this error (set customErrors=”Off” in the Web.config), then you have update the reference in the Visual Studio project:

missingtaxonomy-002

Open Properties for the reference called: Microsoft.SharePoint.Client.Taxonomy and ensure that Copy To Local is set to True:

missingtaxonomy-003

For some reason, this reference added through “App for SharePoint Web Toolkit” nuget package adds a reference to an assembly from your computers GAC.

Copy to SharePoint root from Sublime Text

Note, this is intended for your local development only, not a production environment!

At the moment I’m doing lots and lots of JavaScript for SharePoint, which means this:

  1. Write some JavaScript
  2. Use a Visual Studio plugin to copy to SharePoint root (usually Fishbone’s tool)
  3. Reload page (and by that I mean wait for a long, long time for the page to reload)

I’m doing my development in a virtual machine, with limited resources and Visual Studio seems to be hogging most of them, leaving next to nothing to the SharePoint server.

And I also like working in Sublime Text, I’m just so much more proficient in it.

Solution: Do it all i Sublime!

Here’s what we did: A shortcut to copying a file to the SharePoint hive using the Sublime build system.

1. Create a Sublime build file

In Sublime, go to Tools –> Build System –> New Build System

This creates you a file that looks like this:

Save that, name it to what you want your build system to be called (.sublime-bild as file ending). In it we will call on a powershell script. I saved it in the default location:

 

2. Creating a Powershell script to copy the file

Powershell will simply just do a Copy-Item. The file that you build with our custom build system will be copied from its current location to the hive. It looks like this:

This script takes one parameter: the location of the file that you are calling “build” on. In order to put it in the correct location in the hive, it checks the folder hierarchy relative to the “Layouts”-folder. This means that you have to have the file you’re working on in a path that contains a folder named “Layouts”.

For example, my JavaScript file is located here:

This means that it will end up in the SharePoint hive here:

Save the script somewhere, and name it CopyToSharePointRoot.ps1

3. Using the Powershell script from the build file

We will now change the build-file to make it use the Powershell script with the correct parameter. Change the file you created in the first step to look like this:

In this, change “exact-location-to-your-ps1-script” to the location of your CopyToSharePointRoot.ps1-file. Remember to have double \ for folders. The $file in the last row is a magic parameter given to the build file by Sublime, which we pass on to our script.

4. Using the build system

Got to Tools – Build –> Choose your new build system

If it’s not there, go back to step one and make sure you have the correct location and file ending.

Now open your file that you wish to copy to the hive, change it, hit save and the ctr + b. This should execute the script, and something like this should come up in your Sublime terminal:

 5. Wow, this would be so awesome as a Sublime package!

Fear not, we’re on it!

A new Chuvash keyboard layout

The Chuvash keyboard layout has been the Russian keyboard layout with 4 Chuvash letters that are typed by pressing the right Alt button plus the base letter. Some of the arguments have been

  1. Users don’t need to switch or learn a new keyboard layout. They can keep on typing Russian texts and sometimes Chuvash texts
  2. It is easy to communicate about how the right Alt button works. The Right-Alt-technique is also used in Esperanto, Polish and other languages.
  3. The letters are placed according the labels

Recently two major events happened that made the question about the Chuvash keyboard layout important:

  1. We are working on a Chuvash keyboard for iOS. There we have less place and we have to remove rare Russian letters from the first keyboard screen. There are no physical labels. So we can rethink the whole keyboard.
  2. chuvash.org finally moved from latin equivalents with diacritic marks to Cyrillic letters (Cyrillic extended script). Therefore we need to update users’ keyboard layouts

I’ll write a separate post about the Chuvash Keyboard for iOS. One of the important things we made during that work was to find the frequency of the Chuvash letters. This was used to design the keyboard layout.

Here is the most recent version of the keyboard layout (first screen):

cv-kbd-ios

These are the principles for placing the letters:

  • The most used letters are in the middle.
  • Consonants and vocals come after each other. We tried to avoid many consonants after each other.
  • The letters are often in the same area as in the Russian keyboard layout (but it is not so important)

 

Now to the physical keyboard

When it is possible on a virtual keyboard, wouldn’t it be worth trying on a physical keyboard? Knowing the “best” layout, we can implement it for a physical keyboard. Let’s do it for xkb. xkb is a keyboard system for Linux. I wrote a few articles on that topic.

Many minority languages in Russian use the Russian keyboard layout plus their Cyrillic letters instead of numbers (Bashkir, Udmurt, Kalmyk) or Right-Alt-combinations (Chuvash, Sakha, Komi…). Two other languages have their own keyboard layouts for primary keys: Tatar and Ossetian. Ossetian language has only one extra letter. The Tatar alphabet contains a few more. Let’s look at the Tatar keyboard layout for xkb:

tatar-xkb-kbd

The Tatar keyboard layout uses their letters on the primary keys and puts the Russian letters in the Right-Alt-combinations. It allows:

  • A quicker typing in Tatar
  • And access to Russian letters, because they are part of the official Tatar alphabet, but they are only used in Russian loanwords. The placement of those rare Russian letters are the same as in the Russian layout (except that they are accessible by pressing the Right-Alt button).

Now the Chuvash keyboard layout for Linux and Windows is as follows:

chuvash-xkb-kbd

When I use it, I always press the Right-Alt, because the ӑӗҫӳ in Chuvash are very common. So the Right-Alt is not an exception, rather that a regular typing behaviour. Some Chuvash frequently used Chuvash letters (х, й, э) are placed too from the middle. Some rare letters (ф, ц, ж, о, г, щ) are too “near”.

So let’s change it. If we just take the keyboard layout designed for iOS and put the rare Russian letters “behind the Right-Alt button”, then we’ll get this:

chuvash-xkb-kbd-2015

This keyboard layout will demand some time to learn, but once learned, it will provide

  • a better and quicker typing in Chuvash,
  • less pain in the right thumb,
  • and, perhaps, less Russian loanwords caused by laziness.

Regarding the learning, it could be facilitated using keyboard stickers, printed for Chuvash keyboards. Here is how Russian stickers look like:

The xkb code for the new Chuvash keyboard layout

Creating a Russian Extended Keyboard Layout

In my spare time I am currently working on a Chuvash-Tatar phrasebook. I have used the Chuvash and Tatar keyboard layout on Linux. They work fine, but switching between them takes time. So I decided to add Tatar letters (right Alt + combinations) to my Chuvash keyboard layout. While adding it I found a combined Russian-Ukranian United keyboard layout and I thought:

  • What if I create a new keyboard layout for Russian that will have almost all additional Cyrillic letters? A Russian Extended keyboard layout could be based on the Russian keyboard layout and have other non-Russian letters.

This is what I have come up to so far. The definition can be found on my project at github: russian-extended-kbd. I will update it more and provide more info about how it is organized and how to install it. I’ll also try to implement it for Windows and maybe for Mac (I doubt it, everything is so locked-down there).

rux-xkb-kbd

This is just a proof-of-concept so far. It only works on Linux (with xkb). Nevertheless, some key characteristics of this layout:

  • It has all the letters of Russian, Erzya, Moksha, Chuvash, Udmurt, Mari (Meadow and Hill Mari), Bashkir, Tatar and other languages of the Russian Federation and other countries.
  • It provides powerful dead keys for (breve, diaeresis, double acute, macron) for composing multiple Cyrillic non-Russian letters
  • It is not as quick as “native” keyboard layouts, but you can type text in many languages without switching the keyboard layout.
  • It has many other characters that are not present in the Russian standard keyboard layout for editing in wiki, markdown and other formats: [ ] { } ~, mathematical symbols: ≈ ÷ ∞ ° ‰ ≤ < > ≥ × •
  • It leaves the numbers. Compared too many other keyboard layouts (see below), this layout does not “steal” the number row. You still can type numbers as usual.

Dead keys

As I mentioned above, dead keys is a powerful feature for composing letters. It is harder to write, but the layout can cover many letters.

These dead keys work

diaeresis ӱ ӥ ӓ ӟ ӝ ӹ ӧ ӵ ӛ ё ї ӫ
double acute ӳ
breve ӑ ӗ ў й
macron ӣ ӯ

These do not work for now (but maybe in future):

cedilla ҫ ҙ
bar ғ ұ
hook ң ҳ қ

So many variants of similar letters

A big challenge in creating a Russian Extended keyboard layout is the fact that languages use different letters for the same sounds (meaning similar sounds).

  • /œ/ is ө (Tatar, Bashkir, Sakha…), and ӧ in (Altay, Udmurt, Mari…)
  • /y/ is ӳ (Chuvash), ӱ (Mari, Altay, Khakas), ү (Tatar, Bashkir, Sakha)
  • /ŋ/ is ҥ (Altay, Sakha, Mari), and ң (Tatar, Bashkir, Khakas, Khanty)

Well, the sounds are not the same, but they are similar. The Swedish Ä is not the same as the German Ä either. If we had a more united Cyrillic script, it would be easier to create a keyboard layout and to read and learn each others’ languages.

The letters from different languages are compare in my Google document.

Some “Native” keyboard layouts of the minority languages of the Russian Federation

chuvash-xkb-kbd

udmurt-xkb-kbd

mari-xkb-kbd

komi-xkb-kbd

kalmyk-xkb-kbd

bashkir-xkb-kbd

ossetian-xkb-kbd

sakha-xkb-kbd

tatar-xkb-kbd

 

 

Other Cyrillic keyboard layouts (outside the Russian Federation)

ukrainian-xkb-kbd

belarusian-xkb-kbd

tajik-xkb-kbd

bulgarian-xkb-kbd

kazakh-xkb-kbd

mongol-xkb-kbd