-
Notifications
You must be signed in to change notification settings - Fork 147
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
Feature Suggestion for v3.3: previous language #128
Comments
Right, I already realized that 'Save' runs before the switch and this is where you are supposed to save your custom edits to the original field. Then q-X takes what you saved and copies it to a proper place. Then it replaces original fields with a new language data. Then 'Load' is called, where you are supposed to do your tricks to load the data from the original field to your own environment. This way you do not need to know the language, neither before, nor after. I am trying to design in in the way, that integrators, would not need to know any details of how q-X works, and they should not use any internal variables of q-X, because those are always subject to change. You should only deal with with your own stuff and an original field, just like you would do without q-X at all. You always need a way to update original field, and you always need a way to load original field to your editing element, and that is the only things needed to be called inside If you really need language, there is variable Do you think this design is flexible and robust enough? How would you design it so that we would never have to change it again, even if the internal implementation of q-X is changed? |
Actually, instead of using internal variable Also, I would be curious to know the details of your case, why do you need to know language, because I cannot imagine such a case. Could you describe it? |
It all changes so quickly, that I do not remember all the details myself. I am working on integration documentation now. In fact, 'Save' and 'Load' actions are called with one argument, language code, so you do not need to call |
I suggest to call them
I think with these 2 new callbacks (before and after) it will be easy to implement almost any type of integration.
I also suggest you to create a function to get language name... for example something like because now I have to use your internal array 'language_name' to display language name on UI elements.
I just need to initialize the filed if it's empty based on data entered for another language. My idea was to learn the |
Dmitry, I followed your advices and added arguments and renamed functions in the latest .8, which you are already testing. Please, let me know if this works for you in a complete way, before I start advertising these method for everybody. Once we do that we should never change the names of interface functions anymore. Oops, I forgot about getActiveLanguageName(), will add it on next update. Anything else? I am thinking that plugin like Visual Composer may need to disable Language Switching Buttons (LSB) temporarily to prevent from switching when they open their auxiliary window. So, we may add 'disableLSB()' and 'enableLSB()', or lsbEnable() and lsbDisable(), which naming do you like better? Anything else you may think of? |
Thanks, John! the new callbacks work wonderful.
I prefer more descriptive names... If I do not know what LSB means - I should read the documentation :)
Concerning additional improvements for integration. I think you need to add:
{"en" : { flag: "gb.png", name: "English"}, "ru" : { flag: "ru.png", name: "Русский"} }
After that QTX will be ready for almost any type of integration. |
So, I made so far (in 3.2.9.9.0) getLanguages, getFlagLocation, isLanguageEnabled, addLanguageSwitchBeforeListener, addLanguageSwitchAfterListener, enableLanguageSwitchingButtons. Should be enough for your purpose, is that ok? Any other ideas? |
Thanks, John! I will try it.
what was canceled? it's not connected with my problem of POST array? |
No, it is unrelated to POST, it is only for that one item. |
Ok, thanks. Then I will try the new release. |
This is probably ready to be closed? We can still write into a closed issue and may re-open it if needed. |
If you added
addLanguageSwitchListener
to simplify the integration then it will be also very useful to have some variable or function to know previous language or language before tab switch.In my integration I use
addLanguageSwitchListener
but I need to know from which language was the switch so to be able to copy or update the field for the active language.The text was updated successfully, but these errors were encountered: