Japanese text

Hello. I’m a beginner of Defold.
I think Input Method is buggy on iOS and Android.
On Android tablet, characters are printed twice with one touch.
On iPhone, I can not touch all the hiragana., then I can not convert Hiragana to Kanji.
I’m using ttf font which can output Japanese.
I’m sorry for my poor English.

function init(self)
	msg.post(".", "acquire_input_focus")
end
function on_input(self, action_id, action)
	local txt = gui.get_text(gui.get_node("textNode"))
	if action_id == hash("markedTextAction") then
		gui.set_text(gui.get_node("textNode"), txt .. action.text)
		-- gui.set_text(gui.get_node("textNode"), action.text)
		pprint(action)
	elseif action_id == hash("textAction") then
		gui.set_text(gui.get_node("textNode"), txt .. action.text)
		pprint(action)
	elseif action_id == hash("touchAction") then
		gui.show_keyboard(gui.KEYBOARD_TYPE_DEFAULT, true)
	end
end

Android

iPhone

You shouldn’t concatenate the markedTextAction to the text node. It should only temporarily be displayed while selecting which multi key symbol to use. Once you get a textAction you should remove whatever you built up from markedTextAction.

3 Likes

Also note that for better input handling on Android make sure you have set the input_method to HiddenInputField under the Android category in the game.project file.

4 Likes

Thank you.
HiddenInputField is OK.
I misunderstood MARKED_TEXT. On Android, I solved the problem.
Understanding this code was very helpful( https://github.com/andsve/dirtylarry/blob/master/dirtylarry/dirtylarry.lua#L176 ).
However, On iOS, I can’t solve the problem.
The keyboard In Defold is no predictive conversion of kanji.I can’t customize the keyboard.
I can’t use it as a Japanese App. Using a closed game engine is hard work for Japanese people.

Oh, ok, this is unfortunate. What do you mean by “I can’t customize the keyboard”? Maybe @sven has some input as well?

For example, on iPhone, writing one character in the input field of safari’s google.

Predictive conversions is displayed.
However, The keyboard in defold is blank.


I would like to modify it.