kalessil / yii2inspections

MIT License
32 stars 2 forks source link

Questions: source of key, folders to scan for missing #36

Open qrazi opened 5 years ago

qrazi commented 5 years ago

Hi, I ran the missing translations on a project of ours, but the resulting translations array also includes a whole lot of Craft CMS keys that are already in their own translation arrays.

So based on that I have two questions:

  1. Would it be feasible to include, with comments for instance, what files and linenumbers the translation keys where found? POEdit does this for instance, and this can be helpful when locating the translation key in the sourcecode
  2. Is there a way to exclude some directories from the missing translations inspection? For instance, in our current project I would basically only need to have /templates and /modules checked
kalessil commented 5 years ago

Hi @qrazi, 1) Can you share a screenshot probably, I could not imagine how this might look like? 2) The plugin currently doesn't have any settings, but perhaps we could add translations folders settings into the plugin. Do you mean something like this?

qrazi commented 5 years ago
  1. I was thinking of how this is done with POEdit: image
  2. Yes, I think so. Or I am doing something wrong currently, the plugin seems to also include all strings from Craft CMS, which is not something I am immediately interested in... 😅
kalessil commented 5 years ago

1) IDE has "Find usages" functionality, I'll check if we could hook there up 2) That's a slightly different case, which category do you use for your translations (app, site, or a custom one). Or perhaps you can share a GitHub link where a missing translation is falsely reported?

qrazi commented 5 years ago

Edit2: On the third hand, Craft CMS 3 documentation states:

Within that, create a file named ..., or .php to overwrite a plugin’s messages).

Which makes it a bit strange to have plugin translation keys in site.php?

Edit: Actually, now that I have written all this, the indexing as I describe (1000+ translations) actually still supports my work process fine. Only initially will I see loads of translation in my git diff, after that only new translations. And changing a translations is simply a matter of searching for the exact key in the translations-directory. Indexing all code instead of just my code also allows changing or adding translations for third-party plugins, if I need to do that.

So it seems this is really a non-issue. Not sure if you want to keep it open for 1., but feel free to close this issue if not.

Original:

  1. I could definitely be doing something wrong here. Unfortunately this is not code in a public repo. I'll try with some step by step descriptions, I hope that's ok:

To go back a bit to my goal; I would like an easy enough work process for keeping the static translations in this project managed. So somehow just scan the translations in my templates-directory and my modules-directory?