koreader/koreader — pull request #209 by thotypous (2013-08-11 00:29:19+00:00)
Title: Fix multiple ReaderFrontLight instances, i18n issues, and refactor event handling to follow codebase patterns

Currently, the "Frontlight settings" dialog does not work on Kindle, because the menu callback handler was being called in the base object ReaderFrontLight, not in the instance created in [frontend/ui/readerui.lua:134](https://github.com/koreader/koreader/blob/cea353323eae7f3fd04f9eef8844203fc3670f37/frontend/ui/readerui.lua#L134).

On Kobo, it was working because of various `if self.fl == nil then ReaderFrontLight:init() end` checks, that in fact caused two initializations to be carried, one on each object.

I changed the object to add itself to the menu using the same procedure as used by other menu items, i.e. by calling `self.ui.menu:registerToMainMenu(self)` inside `init()`. This should fix the first issue.

The second issue is related to i18n. No strings in `readerfrontlight.lua` where wrapped inside `_()` calls. For fixing that, one needs to remove the `require` from `inputevent.lua`, because at this point of execution `_()` is not defined yet. Thus, the `Light` key event cannot be handled in `inputevent.lua`. Therefore, I also changed it to be handled using `self.key_events`, as done by other objects in the codebase.

@giorgio130, Please verify if the my code is correct and if it still works in the Kobo. I do not have a Kobo to test, so I simulated a `Light` key event in order to test if the event was being triggered.