-
Notifications
You must be signed in to change notification settings - Fork 98
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
Create Localization Module and integrate into library file #34
Comments
I like the concept, but I think it may be premature. From the QVC user perspective I think having a separate file per language is very easy to understand and modify. What I think would be useful is some type of auto-discovery of language and other files. For example, "if you put a language.qvs file in the QvcRuntime directory we will automatically include it". I get stuck on trying to figure out where the QvcRuntime folder is. |
I see what you are saying as far as the localization to a degree, though it still seems essentially the same as the ColorTheme concept (eg a set of related variables) to me so I don't entirely follow having the API for one and not the other. As far as the auto discovery, was there ever a discussion about having a Qvc.Init function of sorts? In most APIs I have used in the past, there is either a constructor or configuration function that gives the library/object any outside information necessary to do its job. In this case, having the users provide a path to a base directory that contains a prescribed folder/file naming/file type structure could provide a semi-autonomous solution (find the localization, color themeing, config, etc). For example:
At that point we could start making default API calls assume locations for files based on the init and have an optional flag if the user wanted to do an absolute/relative path from the application (or vice versa based on most common use/not breaking the API) CALL Qvc.ColorTheme('Theme1') CALL Qvc.Localize('ES') and similar for any other modules that commonly needed configuration. Users would still be able to add $(includes) anywhere they wanted but we would be providing a consistent and more succinct way of accomplishing it. |
I like the idea of autodiscovery and possibly a Qvc.Init. The chicken and egg problem remains. How do we find Qvc.Init? I've thought about introducing a Qvc.Root variable that would be used like: Thereafter, the fact that Qvc.Root is set will trigger auto discovery. It's the way that Qvc.Global.Extension.Directory works now. |
I would agree, I think ultimately the user is going to have to provide the proverbial chicken somehow until Qlik implements an API that allows a script to be aware of its own file path. One thought as far as an implementation would be that Qvc.Init would be a function defined in Qvc.qvs that the user could call. The user would pass in a root configuration path: Sub Qvc.Init(_rootPath) //Do the automatic config based on Qvc.Root and any other default configuration end Sub So to the user: $(Include=MyPath\Qvc_RunTime\qvc.qvs); Either way would work. I think my object oriented programming background is showing through in wanting to encapsulate any sort of variable assignment in a function call :). |
Like you Nate, coming from an OO background that would be my go to method. However, I have to keep in mind that most QVC users won't be from a software engineering background and so the best solution would for me be the one that is easiest to understand and which fits in with how the rest of QVC works. Ideally we don't change anything that might break existing user's scripts. That all said, we do have a Qvc.Cleanup() which users are used to using, and so having a Qvc.Setup() or similar seems both logical and should be no harder for them to understand. Even if all it does is set a root path in to a variable (which is in turn killed in Qvc.Cleanup) then auto discovery can be triggered as Rob suggested. |
That's a good reminder Matt. Also, I like your idea of Qvc.Setup as a name better. It seems more consistent with Qvc.Cleanup() than Qvc.Init(). |
I can see arguments for both approaches. I like this approach because it's somewhat self-validating and feels natural. "Follow this convention..". If you have an incorrect Qvc.Root, you will find out right away. The presence of Qvc.Root will implicitly enable auto-discovery. But we should we destroy Qvc.Root in Qvc.Cleanup? To force it to be explicitly set? Or would that prevent someone from setting the variable another way? Option 2: Would we validate for the passed directory and throw an error if it doesn't exist? This makes the request for auto-discovery explicit. It also decouples the location of the local config files from the Qvc_Runtime. I may prefer it for that reason alone. But are there files in the QVC distribution we will want to autodiscover? That takes me back to using variables like Qvc.Global.Extension.Directory. I think it's great we are visiting this topic now with a broader set of brains than when I first built the project. Given that, is there an option 3 we haven't surfaced yet? If our requirements were:
If we were starting from scratch, is there something else we would think of? |
Hi, I believe option 1 is the best one, i always prefer explicit over implicit. As for a third option, if there's a way to know where the Alternate Com os melhores cumprimentos / Best Regards Carlos Lisboa On Mon, Jun 8, 2015 at 8:40 PM, RobWunderlich [email protected]
|
Option 4 - Defaults with Configuration Profiles: (Building on top of the decoupling idea that Rob mentioned)
CALL Qvc.LoadProfile('myProfile1'); For example:
This allows for both an implicit default configuration and an explicit profile configuration. I think there is more to be fleshed out there potentially but wanted to put this up for discussion. |
Putting everything into one file would simplify deployment and make Localization more uniform with the rest of the API.
CALL Qvc.Localize('ES');
This would also be a good candidate for making extensible as well.
Thoughts?
The text was updated successfully, but these errors were encountered: