Skip to content
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

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

Open
qrazi opened this issue Apr 5, 2019 · 4 comments
Open

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

qrazi opened this issue Apr 5, 2019 · 4 comments

Comments

@qrazi
Copy link

qrazi commented Apr 5, 2019

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
Copy link
Owner

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
Copy link
Author

qrazi commented Apr 24, 2019

  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
Copy link
Owner

  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
Copy link
Author

qrazi commented Jun 14, 2019

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:
2. 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:

  • I followed: https://docs.craftcms.com/v3/static-translations.html#provide-the-translations
  • So I created a root folder in my project translations with subfolder en
  • I created a site.php
  • image
  • I created a base array and use PHPStorm's hint to add missing translations
  • image
  • It adds 1000+ missing translations
  • Such as "Removes any potentially-malicious code on save,..." image, which only appears in vendor/craftcms/redactor/src/templates/_field_settings.html

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants