-
Notifications
You must be signed in to change notification settings - Fork 115
Javascript file loader #408
base: development
Are you sure you want to change the base?
Javascript file loader #408
Conversation
The idea is interesting, but JavaScript files don't always start with |
@gabrielrobert I liked the idea, but I agree with @Androz2091, since the common way across every environment is |
Many thanks for your reviews. I just updated my branch to bring support for CommonJS exports. Regarding files containing javascript instructions, I don't think it is a good idea to get processing using things like the |
What I meant was not to support these features, but since it will be evaluated, and when the file be written once hit save, the previous format will be dropped, and I don't know how happy the users will be with that thing. |
i18n-manager will not open files containing more advanced javascript features (including comments). A user cannot overwrite a file by error because it won't get loaded at all. This plugin use |
Or the plugin could read the file by using |
I tested this initially and moved from it because it opens the same problems as the |
Yeah, you're right. |
It's not that simple. Some i18n libraries do not work with JSON files, but with JS dictionaries. This PR will bring support for these kinds of files while ignoring any advanced JS features. At the end of the day, it's your call! I use |
Got it, but, are you sure that they don't support even if you manually provide them? like, importing the files and then provide the objects. |
Sure, they do. But in my case, I use more advanced javascript features, and I do pre-process those files before editing them with i18n-manager. For instance:
Become
Then I can edit them. i18n-manager stay super useful even when the format is partially supported. |
Understood, I see now the importance of it. I was thinking and I don't think we need to care about security things, since the tool only runs locally, so there's no risk :) And using eval sounds more reliable, so we don't need to care about punctuation and any other thing. Resulting in less work that results in less maintenance :D What you think about that? |
Correct me if I'm wrong, but Electron applications can run with administrative power. Someone could create a reproduction repo for you with malicious code getting executed when you open the |
Users should be careful what file they open and make sure they have installed the correct version of i18n-manager 🤷 |
Hehehe, having this in mind, why does antivirus software still exist? 😜 |
@gabrielrobert I don't think it's the case Firstly, Electron has a packaging thing that we can't write into it easily. Remember, if the user wants to do shit, they will do, and it's not our fault XD |
@gabrielrobert about punctuation, was more about having |
@gilmarsquinelato
The problem is not the Electron package itself, but the translation file you load. Let's say I put malicious code in |
@gabrielrobert ah, got it, very nice point of view 😄 Ok, so then I'll test it and approve 😄 One thing related to the And be explicit on the |
This PR add the possibility to load javascript files using this format:
This format is used by libraries like nuxt-i18n/vue-i18n.