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

fixed expand_translator.lua #336

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions sample/lua/expand_translator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ schema:
schema_id: cangjie5
engine:
translators:
- lua_translator@expand_translator
#- lua_translator@expand_translator
- lua_translator@*expand_translator@expand_translator # autoload


expand_translator:
wildcard: "*"
Expand All @@ -30,7 +32,7 @@ end

local function memoryCallback1(commit)
for i, dictentry in ipairs(commit:get()) do
commits:update_entry(dictentry, 1, "")
commit:update_entry(dictentry, 1, "")
end
--commits:update(1) --
end
Expand All @@ -47,12 +49,15 @@ local function init(env)
-- env.mem = Memory(env.engine, schema, "translator")
config = env.engine.schema.config
namespace = 'expand_translator'
env.wildcard = config:get_string(namespace .. '/wildcard')
env.wildcard = config:get_string(namespace .. '/wildcard') or "*"
-- or try get config like this
-- schema = Schema("cangjie5") -- schema_id
-- config = schema.config
log.info("expand_translator Initilized!")
end
local fini(env)
env.mem = nil
end


local function translate(inp,seg,env)
Expand All @@ -76,4 +81,4 @@ local function translate(inp,seg,env)
end
end

return {init = init, func = translate}
return {init = init, fini= fini, func = translate}