Notices


Reply
Thread Tools
Posts: 12 | Thanked: 37 times | Joined on Jan 2014
#1
[2015-06-15: Updated jolla-anthy-jp to v0.04]
[2014-11-09: Updated jolla-anthy-jp to v0.03]
[2014-05-17: Updated jolla-anthy-jp to v0.02]

TL;DR:

Enable installing of untrusted software in the settings, then install the following three packages (in order):

Then reboot the phone.

Hi everyone.

As I've mentioned on together.jolla.com already, the last major feature that I was missing on my Jolla was the ability to input Japanese. However, as there was no response from Jolla nor from what I've seen any major effort from a third party to develop a Japanese input method, I finally gave up and took it upon myself to at least create a working proof of concept. Well, said and done, I now have a fully usable input method, though it is very, very much in alpha state.

To use this input method, you'll need three packages: anthy, which segments kana and converts it into kanji; libanthy-qml-plugin, which acts as a thin wrapper around anthy, making the library usable from QML; and finally jolla-anthy-jp, which contains the actual keyboard layout as well as logic such as wāpuro rōmaji→hiragana conversion, kanji candidate selection, and more.

Anthy is of course not written by me, but is a preexisting project licensed under the LGPL. Its official website can be found at http://sourceforge.jp/projects/anthy/.

The above linked packages can be installed from the GUI by allowing untrusted software in the settings, or from terminal by running
Code:
$ pkcon install-local
with the RPM files as arguments. The latter requires developer mode to be enabled.

After installing the packages, you either need to restart the Maliit keyboard or reboot the device. To restart the Maliit keyboard (again, this requires developer mode):
Code:
$ systemctl --user restart maliit-server.service
The source code for libanthy-qml-plugin and jolla-anthy-jp can be found at https://github.com/BeholdMyGlory/libanthy-qml-plugin and https://github.com/BeholdMyGlory/jolla-anthy-jp, respectively.

In addition, I've created a repository at openrepos.net, which you should be able to add to the package manager in Sailfish if you don't want to install the above packages manually. From there you can install jolla-anthy-jp, and anthy and libanthy-qml-plugin should come along as dependencies. You can also find screenshots there.

Now, keep in mind that, as I said, this is very much a non-stable version, so don't be surprised if anything wonky happens, and please report back if you have any suggestions for improvements or fixes---or even better, do a pull request on GitHub.

Known issues
  • The actual keyboard layout is simply the English layout with an added chōonpu ('ー'), meaning that characters like '[' are still shown as '[' rather than '「', and '?' gives you a standard half-width question mark rather than a full-width question mark ('?'). If anyone has any idea how exactly a Japanese-specific keyboard layout should look, please do come with suggestions.
  • Special characters like 'ä' are mangled by Anthy.
  • Any non-special latin characters left in the input string as it goes through Anthy will likely be converted into upper case for the leftmost candidate choice (e.g. "てすとk" might appear as "テストK"), as the leftmost choice is simply a concatenation of the first canditate for every segment of the input string, and the first candidate returned by Anthy for latin characters generally seems to be the upper case version of said character.

Changes as of v0.04
  • Fixed crashes when selecting predictions
  • Added split keyboard support and disabled autoshift (thanks to sleepsounds on TMO!)

Changes as of v0.03
  • Added workaround to fix the frequent crashing when selecting candidates other than the leftmost one.

Changes as of v0.02
  • Replaced workaround for starting the correct input handler with specifying the input handler in the .conf file
  • Updated the prediction bar to look better and include the clipboard

P.S.: If you find yourself wanting to hack the code or experiment with your own input handlers, the way to get output from your code is by stopping Maliit and then starting it again in the foreground:

Code:
$ systemctl --user stop maliit-server.service && maliit-server
Running maliit-server manually also allows you to debug your code with gdb, if you've written a QML extension in C++.

As far as hacking the keyboard goes, the interesting files are the .qml files in /usr/share/maliit/plugins/com/jolla/ (especially KeyboardBase and InputHandler) as well as /usr/lib/maliit/plugins/jolla-keyboard.qml. Binary plugins for the keyboard can be found in /usr/lib/qt5/qml/com/jolla/{keyboard,xt9,xt9cp}.

Last edited by Behold; 2015-06-15 at 21:54.
 

The Following 18 Users Say Thank You to Behold For This Useful Post:
Custodian's Avatar
Posts: 722 | Thanked: 2,253 times | Joined on May 2012 @ Moscow, Russia
#2
Glad to see that you have chosen openrepos.net for distributing

It is my fault, that there is no public publishers guide yet.

One thing on openrepos usage:

You have uploaded multiple packages to same application. All packages have different names.
This will confuse Warehouse application.
To make it work as expected you have to select one of the ways:
1) Create separate applications for each rpm package
2) While editing sailfishos package, move main 'jolla-anthy-jp' package to the top of the uploaded files list, so it will be the first one in attachment list.
__________________
twitter: @basil_s home: http://thecust.net
OpenRepos.net - community driven repository project. Warehouse - native client for OpenRepos.net
Buy me a beer

Last edited by Custodian; 2014-01-10 at 09:03.
 

The Following User Says Thank You to Custodian For This Useful Post:
Posts: 12 | Thanked: 37 times | Joined on Jan 2014
#3
Originally Posted by Custodian View Post
Glad to see that you have chosen openrepos.net for distributing :cool:

It is my fault, that there is no public publishers guide yet. :(

One thing on openrepos usage:

You have uploaded multiple packages to same application. All packages have different names.
This will confuse Warehouse application.
To make it work as expected you have to select one of the ways:
1) Create separate applications for each rpm package
2) While editing sailfishos package, move main 'jolla-anthy-jp' package to the top of the uploaded files list, so it will be the first one in attachment list.
Oh, sorry, I didn't really think of the users of OpenRepos when I added the packages, I mostly just wanted a place where I could keep up-to-date RPM packages of the software and to where I could direct people on e.g. TMO and together.jolla.net. I've now changed the order of the packages so that jolla-anthy-jp is first in the list; that should be enough, right? I also added a link back to this thread in the description; I'll see if I can be bothered to write a proper description a bit later.
 

The Following 2 Users Say Thank You to Behold For This Useful Post:
Miharin's Avatar
Posts: 72 | Thanked: 75 times | Joined on Nov 2013 @ Finland
#4
Cool stuff, it works! ありがとうございます!��
__________________
Jolla want list: disabling vibrate from Facebook messages
 

The Following User Says Thank You to Miharin For This Useful Post:
Custodian's Avatar
Posts: 722 | Thanked: 2,253 times | Joined on May 2012 @ Moscow, Russia
#5
Originally Posted by Behold View Post
that should be enough, right? I also added a link back to this thread in the description; I'll see if I can be bothered to write a proper description a bit later.
Didn't noticed your answer at a time.
You did it right, everything is cool
__________________
twitter: @basil_s home: http://thecust.net
OpenRepos.net - community driven repository project. Warehouse - native client for OpenRepos.net
Buy me a beer
 

The Following User Says Thank You to Custodian For This Useful Post:
Posts: 16 | Thanked: 2 times | Joined on Dec 2013
#6
Awesome, thanks! Much appreciated!

Edit: "found" an issue, need to learn to read posts more carefully...

Last edited by phuig; 2014-01-15 at 09:09.
 

The Following User Says Thank You to phuig For This Useful Post:
Posts: 144 | Thanked: 241 times | Joined on Nov 2007 @ Finland
#7
Looks excellent. You could think about fewpath and naming changes to avoid collisions with possible future OS packages in Jolla. You can also create postinstall and postuninstall script to your RPM package to enable maliit.service restart. Just add following to SPEC file.

Code:
%post
su nemo -c "/bin/systemctl --user restart maliit-server.service"

%postun
su nemo -c "/bin/systemctl --user restart maliit-server.service"
 

The Following 3 Users Say Thank You to Penguin For This Useful Post:
Posts: 4 | Thanked: 2 times | Joined on Jan 2014 @ Finland
#8
Thank you very much for figuring out how to plug in a custom input method for Sailfish.

If you have the time, could you please explain how the "jolla-anthy-jp" rpm is built. Based on this thread, I finally decided to write an input method for Korean (sources here: https://github.com/ascense/jolla-hangul), but I cannot figure out how to make a non-binary rpm (the SDK really wants to have something to compile...)
 

The Following User Says Thank You to Ascense For This Useful Post:
Posts: 144 | Thanked: 241 times | Joined on Nov 2007 @ Finland
#9
Don't use SDK to pack the RPM. You can create spec file with any text editor and use rpm-build to create rpm package. I think SDK will also sandbox you out of keyboard folders.
 

The Following User Says Thank You to Penguin For This Useful Post:
Posts: 12 | Thanked: 37 times | Joined on Jan 2014
#10
Originally Posted by Ascense View Post
Thank you very much for figuring out how to plug in a custom input method for Sailfish.

If you have the time, could you please explain how the "jolla-anthy-jp" rpm is built. Based on this thread, I finally decided to write an input method for Korean (sources here: https://github.com/ascense/jolla-hangul), but I cannot figure out how to make a non-binary rpm (the SDK really wants to have something to compile...)
As Penguin said, the easiest way is to build the RPM outside of QtCreator. What I did personally was I first launched the SDK through QtCreator (open a Sailfish project and then click "Start Sdk" near the bottom in the sidebar; there's probably a way to launch the SDK without using QtCreator, but I don't know how personally), then I SSH'd in to the SDK (see https://sailfishos.org/develop-faq.html, "How do I login into the emulator or build engine?" > "Build Engine", "as user mersdk"). There I just ran rpmbuild -bb manually against my spec file. You need to make sure that you have the sources packaged correctly in ~/rpmbuild/SOURCES, though.
 

The Following User Says Thank You to Behold For This Useful Post:
Reply

Tags
input method, sailfish os

Thread Tools

 
Forum Jump


All times are GMT. The time now is 15:24.