weblate icon indicating copy to clipboard operation
weblate copied to clipboard

Component discovery wizard

Open orangesunny opened this issue 5 years ago • 2 comments

Is your feature request related to a problem? Please describe. It is hard, even for some developers, to figure out the correct regular expression for the component discovery addon.

Describe the solution you'd like As the translation finder sees all the translation files, it would be nice to just select their folders by checkboxes instead of a regular expression. I suggest a wizard with three steps:

  1. Search all translations within the repository
  2. Select the folders you want to use continuously.
  3. Confirm your choices by agreeing to something like "Following folders will be monitored and new components will be added in the future with this pattern: "

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Version 2 would be adding multiple components straight from the start, without needing to set up the first one and then the addon.

orangesunny avatar May 29 '20 07:05 orangesunny

I get that this is a complex problem. The regex is very strong in beeing able to target several files in parallel paths, which is very tedious and also difficult to interpret by the user when done in a "click through" wizard.

you should probably look at the most common case(s) and provide a simple wizard for that/those situations only.

let's consider the following repo structure as an example:

myproject/
    mysrc/
        foo.py
        localization/
            en/
                trans.po
            it/
                trans.po

with the current regex configuration I would go for something like mysrc/localization/*language*/*.po (some pseudo regex).

the use of the regex named group to identify the language of the localization is a good tool for power users, but not every developer uses regex frequently and if he does he maybe never used these group names so this limits access even to a lot of developers, people without any knowledge about them will likely be unable to fill in anything.

i originally suggested a wizard for this, because it would help inexperienced users to approach this critical part of the integration of weblate into their projects. however, i fully recognize, that no one wizard would be able to just replace the regex and be as powerful while still beeing easy to understand.

that's where my suggestion is coming from:

  • identify typical entries for this field and develop some solution (like a wizard) for that
  • maybe offer a scan functionality (e.g. for a filetype) and make the user deselect the files which are false positives.

cs-luca avatar Jun 03 '20 10:06 cs-luca

The scanning is already there when adding a component:

user-add-component-discovery

What needs to be done is aggregate this to regexp when there are multiple matches in same path. That should not be that hard as the most tricky part is identifying files to translate and translation-finder already covers that.

nijel avatar Jun 03 '20 10:06 nijel