require "smartinput"

local lng = smartinput.new_language("手", "HandWrite")

local pkgname = ""
local chspkgname = ""

lng.support_mode = smartinput.context.MATH + smartinput.context.PHONE + smartinput.context.NUMBER

lng.surfaces = {
    {
        surface_id = pkgname .. "chs_handwrite.sur",
        surface_type = smartinput.surface_type.SOFT_KEYBOARD,
        surface_subtype = smartinput.surface_subtype.KEYBOARD_FULL,
        surface_display_name = "chs_handwrite",
    },

    {
        surface_id = pkgname .. "chs_handwrite_half.sur",
        surface_type = smartinput.surface_type.SOFT_KEYBOARD,
        surface_subtype = smartinput.surface_subtype.KEYBOARD_PHONEPAD,
        surface_display_name = "chs_handwrite",
    },

    {
        surface_id = "more.sur",
        surface_type = smartinput.surface_type.SOFT_FULLCANDIDATE,
        surface_display_name = "more",
    },

    {
        surface_id = "chs_sym_number.sur",
        surface_type = smartinput.surface_type.SOFT_SYMBOL,
        support_mode = smartinput.context.MATH,
        surface_display_name = "symbol",
    },

    {
        surface_id = "number.sur",
        surface_type = smartinput.surface_type.SOFT_SYMBOL,
        support_mode = smartinput.context.NUMBER + smartinput.context.MATH,
        surface_display_name = "number",
    },
	
	{
        surface_id = "number_only.sur",
        surface_type = smartinput.surface_type.SOFT_SYMBOL,
        surface_display_name = "number_only",
    },

	{
        surface_id = "chs_abc.sur",
        surface_type = smartinput.surface_type.SOFT_SPECIAL,
        surface_layout = smartinput.surface_layout.QW,
        surface_display_name = "abc",
    },
}

lng.support_keyboard = {
	smartinput.keyboard_type.SOFT_KEYBOARD
}

lng.categories[smartinput.language.category.FASTSWITCH] = "chinese"
lng.categories[smartinput.language.category.LAYOUT] = "handwrite"
lng.categories[smartinput.language.category.RECOGRANGE] = "chinese_handwrite"

lng.traits = "chspy_traits.trt"

lng.dictionary = smartinput.new_engine(smartinput.dictionary.engine_type.OCEAN, smartinput.dictionary.dict_type.CHS_PINYIN)

lng.dictionary.files = {
	{
		file_name = "pinyin.rom",
		file_type = smartinput.dictionary.image_type.ROM,
		open_mode = smartinput.file.READ,
        load_mode = smartinput.dictionary.load_mode.PURE_ARRAY
	},
	{	
		file_name = "chinese_simplified.usr",
		file_type = smartinput.dictionary.image_type.USR,
		open_mode = smartinput.file.READWRITE
	},
}

lng.handwrite = smartinput.new_engine(smartinput.dictionary.engine_type.CLOUDHW, -1)

lng.handwrite.files = {
	{
		file_name = pkgname.."HWR_SYS_MUL_UNI_20120112140000",
		open_mode = smartinput.file.READ,
	},
	{
		file_name = pkgname.."HCI_USR_INFO",
		open_mode = smartinput.file.READWRITE
	},
	{
		file_name = pkgname.."HWR_SYS_ASS_GBK_20120112140000",
		open_mode = smartinput.file.READWRITE
	},
	{
		file_name = pkgname.."HWR_USR_HIS",
		open_mode = smartinput.file.READWRITE
	},
}

lng.get_traits = function ()
    if not lng.loaded_traits then
        lng.loaded_traits = _G.dofile(lng.traits)
    end
    return lng.loaded_traits
end

return lng
