small fixes to get a runable example:#10
Open
AndiEcker wants to merge 1 commit into
Open
Conversation
- fixed declaration of args in fbind()/funbind() like declared in _events module. - removed unneeded return statement in fbind()/funbind(). - corrected first parameter for notification func (from args to args[0]).
AndiEcker
commented
Jul 20, 2020
| @@ -18,29 +18,29 @@ def __init__(self, defaultlang): | |||
| def _(self, text): | |||
Author
There was a problem hiding this comment.
optional extension: by re-declaring the method _ into __call__ one could instantiate the Lang class directly to a variable with the name _ like so _ = Lang("en") and with that the tr._("translate me") could be replaced by `_("translate me"), and use it like in the original gettext C implementation.
AndiEcker
commented
Jul 20, 2020
| self.observers.append((func, args, kwargs)) | ||
| else: | ||
| return super(Lang, self).fbind(name, func, *largs, **kwargs) | ||
| super(Lang, self).fbind(name, func, *args, **kwargs) |
Author
There was a problem hiding this comment.
Just noticed in the kivy documentation (https://kivy.org/doc/stable/api-kivy.event.html) that fbind should actually return an uid. For to accomplish this how would the uid be created for the case where name == '_' ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
first big thanks @tito for this example which is the most clean one I found for to implement i18n into kivy apps. This PR is fixing some small bugs that may help others in the future: