Git Product home page Git Product logo

Comments (6)

kkofler avatar kkofler commented on June 2, 2024

The:

# group is not in our group definition, but it's into the repository
# we just use it

case is not correct. (Note that the group definition covers only the toplevel categories, by design. It should not be needed at all, it is only a workaround for manatools/dnfdaemon#9. This is already bad enough, hardcoding all of comps is not a good idea IMHO.)

Making this work right is what my id_to_name_map was for (note that this is built at runtime and not the same as the hardcoded name_to_id_map in compsicons.py that you renamed to _group_info), which you removed the usages of. In comps, the ID is not the same as the pretty name, which is why my comps code was deliberately different from the RPM groups code.

from dnfdragora.

anaselli avatar anaselli commented on June 2, 2024

Sorry i didn't understand that name_to_id_map was evaluated at run-time...
Is that containing localized strings?
Since I'm not a Fedora user/developer can you explain how it works at run-time so that i'll try to use it following the groupicons API - or at least finding a common interface?
thank you

from dnfdragora.

anaselli avatar anaselli commented on June 2, 2024

commit d10cfc7 should have fixed that, however titles are not localized, we have to take that in account sooner or later. Maybe a static and not always up to date dictionary that can be translated is better than a not translated one at run time... improving the script we have nowadays should not be that pain... wdyt?

from dnfdragora.

kkofler avatar kkofler commented on June 2, 2024

(I was writing up this long post when you committed the latest changes.)

The name_to_id_map was a constant, the id_to_name_map was not. (They have similar names, but they are not opposites of each other, they map different things. My naming could probably have been better, and my comments more extensive.)

  • name_to_id_map: workaround for manatools/dnfdaemon#9. Maps the untranslated name that dnfdaemon puts into the ID field (gl[0]) for (toplevel) categories to the actual ID needed to look up the icon. No mapping is done for (non-toplevel) groups, where the ID is already correct. The idea was that if and when dnfdaemon gets fixed, no changes should be needed (but the map could eventually be emptied or the mapping code removed, though the code should also work with a fixed dnfdaemon while the map is still there). It just maps dnfdaemon ID → comps ID. Outside of the icon lookup code, the dnfdaemon ID (gl[0]) is used as is. Looking at your changes, I believe that your code still does that part correctly. The icons also come up right for me.
  • id_to_name_map: built at runtime in https://github.com/anaselli/dnfdragora/pull/7/files#diff-6a15535e26dbe9e53bdd869800e5517aR442. Maps the dnfdaemon ID (gl[0]) to the dnfdaemon UI name (gl[1]). The thing is, in comps, the internal ID is not what we want to display to the user, a name is specified there. (The name should even come already translated, but this is not working at the moment, see manatools/dnfdaemon#10.) DNF actually has 3 "names": id, name (comps name as is, untranslated), and ui_name (translated comps name). dnfdaemon's gl[1] is the ui_name. It is just not translated yet because the locale is not set anywhere.

from dnfdragora.

kkofler avatar kkofler commented on June 2, 2024

Since I'm not a Fedora user/developer can you explain how it works at run-time so that i'll try to use it following the groupicons API - or at least finding a common interface?

Well, the reason I split the code in the first place is that I was not able to figure out how to make the 2 versions of the code work with the same interface, because there was the assumption that the ID is also the title if we don't have a title in our hardcoded group_info. But you found a way now anyway.

commit d10cfc7 should have fixed that

Yes, this looks good to me (building your group_info at runtime), though I have not tried it yet.

however titles are not localized, we have to take that in account sooner or later.

This is manatools/dnfdaemon#10.

Maybe a static and not always up to date dictionary that can be translated is better than a not translated one at run time... improving the script we have nowadays should not be that pain... wdyt?

I don't think reinventing the comps translations is going to help. You could try to load the existing comps .mo files from the system. But I think it would make more sense to just get dnfdaemon to return the translated identifiers to begin with.

from dnfdragora.

anaselli avatar anaselli commented on June 2, 2024

agreed :)

from dnfdragora.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.