parrot icon indicating copy to clipboard operation
parrot copied to clipboard

Namespace-based UI

Open StanBoyet opened this issue 9 years ago • 11 comments

Hi,

We use a Rails app and we have been for a long time for a tool like the one you built 😃 We use a YAML file to manage this, the classic Rails' Way ©

One thing that's missing on our part is the ability to filter/organize the strings into their namespace. We have ~2k keys so having them all is not manageable for us.

Here a quick example of a our issue in the strings index, but the same thing applies for the locale translation view:

screenshot 2017-01-17 15 02 56

What we would have is:

  • categories
    • fruits
      • apple
      • lemon
    • vegetables
      • asparagus
      • lettuce

By default everything would be collapsed.

Unfortunately we don't have any Angular skillset in the company, otherwise we would have loved to contribute.

Let me know if this is of intesest, and if we can help in any way.

Thanks again, awesome project. Can't wait to use it in production 👌

StanBoyet avatar Jan 17 '17 14:01 StanBoyet

Nice call, StanBoyet. I'd second this :)

PatrickWatzlawik avatar Jan 17 '17 14:01 PatrickWatzlawik

Thanks for the suggestion. Definitely makes sense to have some sort of visual grouping for the project's strings. Unfortunately, not everyone uses a convention for naming their strings, so Parrot makes no assumptions about the format of the strings, but we can still try a few things:

The idea that you suggest of a collapsible list based on each sub-string sounds good to me. The only issue with it is the handling of "non-standard" string names, we could display the new collapsible component if we can auto-detect a naming convention or fallback to the current UI component if we can't.

On the other hand, a search field to filter out the strings could be simpler and maybe better (or worse) for some users.

anthonynsimon avatar Jan 17 '17 15:01 anthonynsimon

I think the main issue is the resulting translation.json. It is not that important to have a visual grouping but a json-grouping.

So the .json looks so: "foo": { "bar": "baz" }

and not this way: "foo.bar": "baz"

I really hope I'm not mistaken here, but I thought to get into that inconvenient issue last weekend.

PatrickWatzlawik avatar Jan 17 '17 15:01 PatrickWatzlawik

Gotcha, so just to be sure basically what we need is a YAML export option (with the nesting of the sub-strings)? For example:

In Parrot:

# locale: en_US
books.index.title: "Title"

# locale: es_ES
books.index.title: "Título"

If exported as YAML should produce:

# en_US.yml
en:
  books:
    index:
      title: "Title"
 
# es_ES.yml
es:
  books:
    index:
      title: "Título"

I guess it would be safe to expect such a naming convention on the strings when exporting as YAML.

anthonynsimon avatar Jan 17 '17 16:01 anthonynsimon

For other formats, this can be implemented too. What could work in order to not constrain the naming convention to a specific style, is an option to "split-n-nest" based on a character. Yay or nay? :)

anthonynsimon avatar Jan 17 '17 16:01 anthonynsimon

Looks fine :) I'm not really sure what you meant with "split-n-nest".. In terms if UI, I thought of a checkbox if the exported file should contain nested values or not

PatrickWatzlawik avatar Jan 17 '17 16:01 PatrickWatzlawik

I added support for yaml export with nested strings. Sample output:

es_ES:
  categories:
    fruits:
      apple: Manzana
      pineapple: Piña
      watermelon: Sandia
    veggetables:
      paprika: Chile dulce
      potato: Patata

I will keep the issue open for now as the UI namespaces collapsing mentioned by StanBoyet is still a valid point.

anthonynsimon avatar Jan 17 '17 22:01 anthonynsimon

Wow this is already super neat ! Thanks a lot ! Let me know if we can be of any help.

StanBoyet avatar Jan 18 '17 06:01 StanBoyet

Small issue on the web app, there is no YAML export option available (just pulled the code, restarted the server)

screenshot 2017-01-18 08 56 42

StanBoyet avatar Jan 18 '17 07:01 StanBoyet

Did you also rebuild the web app before restarting the servers?

$ sudo /bin/bash scripts/release.sh

I need to rename that script, that's not an obvious one :)

anthonynsimon avatar Jan 18 '17 09:01 anthonynsimon

My bad, works great after rebuilding :)

Gonna look the notifications for news on your part for the UI then :)

StanBoyet avatar Jan 18 '17 09:01 StanBoyet