Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Czech diacritics #731

Closed
vaclavvanik opened this issue Mar 9, 2019 · 2 comments
Closed

Czech diacritics #731

vaclavvanik opened this issue Mar 9, 2019 · 2 comments

Comments

@vaclavvanik
Copy link

Hi @Mottie,

could you help me, why diacritics combo is not working? Default combos like "a turns into ä. I am unable to setup czech conventions. Eg caron c turning into č.

My current setup is:

$('.keyboard-normal').keyboard({
    layout: 'ms-Czech',
    autoAccept: true,
    usePreview: false,
    initialized : function(e, keyboard, el) {
        keyboard.regex = /([`\'~\^\"ao\u02c7\u00b4])([a-z])/mig;
    },
    combos: {
        // caron
        '\u02c7': { e: '\u011b', E: '\u011a', s: '\u0161', S: '\u0160', c: '\u010d', C: '\u010c', r: '\u0159',
                R: '\u0158', z: '\u017e', Z: '\u017d', d: '\u010f', D: '\u010e', t: '\u0165', T: '\u0164', n: '\u0148', N: '\u0147'},
        // acute
        '\u00b4': { a: '\u00e1', A: '\u00c1', e: '\u00e9', E: '\u00c9', i: '\u00ed', I: '\u00cd', o: '\u00f3',
                     O: '\u00d3', u: '\u00fa', U: '\u00da', y: '\u00fd', Y: '\u00dd'}
    }
});

Thanks for your advise.

@Mottie
Copy link
Owner

Mottie commented Mar 9, 2019

Hi @vaclavvanik!

It looks like this is a bug in this library with setting the keyboard.regex. Since the layout has the language is set to cs and it can't find that language file, it's reverting the regex back to the default stored in $.keyboard.comboRegex.

To get around that for now, set your regex in $.keyboard.comboRegex (demo):

$(function() {
  $.keyboard.comboRegex = /([`\'~\^\"ao\u02c7\u00b4])([a-z])/gim;

  $("#keyboard")
    .keyboard({
      layout: "ms-Czech",
      autoAccept: true,
      usePreview: false,
      combos: {
        // caron
        ˇ: {
          e: "\u011b",
          E: "\u011a",
          s: "\u0161",
          S: "\u0160",
          c: "\u010d",
          C: "\u010c",
          r: "\u0159",
          R: "\u0158",
          z: "\u017e",
          Z: "\u017d",
          d: "\u010f",
          D: "\u010e",
          t: "\u0165",
          T: "\u0164",
          n: "\u0148",
          N: "\u0147"
        },
        // acute
        "\u00b4": {
          a: "\u00e1",
          A: "\u00c1",
          e: "\u00e9",
          E: "\u00c9",
          i: "\u00ed",
          I: "\u00cd",
          o: "\u00f3",
          O: "\u00d3",
          u: "\u00fa",
          U: "\u00da",
          y: "\u00fd",
          Y: "\u00dd"
        }
      }
    })
    // activate the typing extension
    .addTyping({
      showTyping: true,
      delay: 250
    });
});

And it would be of great help to me and others if you would consider contributing a translated language file for Czech. I noticed I didn't have one in place, so in the next release I'll fix this bug and I'll include a language/cs.untranslated.js file.

Mottie added a commit that referenced this issue Mar 9, 2019
Only if no language definition regex exists
@Mottie
Copy link
Owner

Mottie commented Mar 9, 2019

New release is now available!

You can now include the cs.untranslated.js file and not have to include the comboRegex or combo while initializing.

@Mottie Mottie closed this as completed Mar 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants