view src/luan_editor/Spell_checker.luan @ 72:7db13b68ab1b default tip

finish mac
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 15 Jun 2025 15:31:05 -0600
parents 99ebb6176d2f
children
line wrap: on
line source

local Luan = require "luan:Luan.luan"
local error = Luan.error
require "java"
local System = require "java:java.lang.System"
local SpellCheckerLuan = require "java:luan_editor.SpellCheckerLuan"


local Spell_checker = {}

local dir = System.getProperty("dictionaries") or error()
SpellCheckerLuan.registerDictionaries( "file:"..dir, "en" )

function Spell_checker.spell_check(text_component,spell_check)
	local jtext_component = text_component.java
	if spell_check then
		SpellCheckerLuan.register(jtext_component)
	else
		SpellCheckerLuan.unregister(jtext_component)
	end
end

return Spell_checker