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

Support Plugin Interface #9

Open
tebaly opened this issue Jun 3, 2018 · 3 comments
Open

Support Plugin Interface #9

tebaly opened this issue Jun 3, 2018 · 3 comments

Comments

@tebaly
Copy link
Contributor

tebaly commented Jun 3, 2018

For example in other languages your code "1337 characters" is useless. For me, this path of library is useless.

I would like to add the functionality of locally used templates. It would be nice to write a plugin and make it possible to connect it via the library. There are many languages - there can be many plug-ins, their development can go independently.

You can extract this part of your library in a separate plugin to show how it can be done by other developers for other languages (Russian etc.)

    /**
     * A mapping that maps regular characters to 1337 characters.
     *
     * @type {{o: string, g: string, b: Array, t: string, s: string, a: string, e: string, z: string, i: string, l: string}}
     */
    this.map1337 = {
      o: '0',
      g: '9',
      b: ['8', '6'],
      t: '7',
      s: '5',
      a: '4',
      e: '3',
      z: '2',
      i: '1',
      l: '1'
    };
  }

//...
        if (typeof this.map1337[character] === 'undefined') {
          pattern += (character + (!last ? any : ''));

          continue;
        }

        if (typeof this.map1337[character] === 'string') {
          pattern += ('((' + character + '|' + this.map1337[character] + ')' + (!last ? any : '') + ')');

          continue;
        }

        pattern += '((' + character;

        for (var m = 0; m < this.map1337[character].length; m++) {
          pattern += '|' + this.map1337[character][m];
        }

//...
@tebaly
Copy link
Contributor Author

tebaly commented Jun 3, 2018

For the Russian language, similar functionality is required (For Example)

'zh' => 'ж',
'ts' => 'ц', 
'ch' => 'ч',
'sh' => 'ш', 
'kh' => 'х',
'je' => 'э',
'ä' => 'э',
'ju' => 'ю',
'yu' => 'ю',
'ü' => 'ю',
'ja' => 'я',
'ya' => 'я',
'q' => 'я',
'jo' => 'е',  
'yo' => 'е', 
'ye' => 'е', 
'ö' => 'е', 
'e' => 'е',
'ji' => 'л', 
'yi' => 'и',
'ї' => 'и', 
'a' => 'а',
'b' => 'б',
'v' => 'в',
'w' => 'в',
'g' => 'г',
'd' => 'д',
'z' => 'з',
'i' => 'и',
'j' => 'и',
'k' => 'к',
'l' => 'л',
'm' => 'м',
'n' => 'н',
'o' => 'о',
'p' => 'п',
'r' => 'р',
's' => 'с',
't' => 'т',
'u' => 'у', 
'y' => 'у',  
'f' => 'ф',
'h' => 'х',
'x' => 'х',
'}{' => 'х', 
')(' => 'х',  
'][' => 'х', 
'шч' => 'щ', 
'сч' => 'щ',  
'й' => 'и',
'ё' => 'е',
'9' => 'д',
'6' => 'ш',
'8' => 'в',
'3' => 'з',
'4' => 'ч',
'0' => 'о',
'()' => 'о',
'/-\\' => 'а',
'/\\' => 'л',
'|<' => 'к', 
'/<' => 'к',  
'\<' => 'к',  
'}/{' => 'ж', 
'}|{' => 'ж', 
']|[' => 'ж',  
'|-|' => 'н',
'тт' =>'п',
'c' => 'ц' 

@RWOverdijk
Copy link
Member

That would be cool, yes! Passing in character sets for your own locale, good idea.

I'd join an array and expand it in the patterns.

@RWOverdijk
Copy link
Member

5 years later I am once again looking at this lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants