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

Fix header of search result sections (RhBug:1301868) #792

Closed

Conversation

jrohel
Copy link
Contributor

@jrohel jrohel commented Apr 21, 2017

Header of the section will be correctly denote its content.
examples:

  • Name Exactly Matched: ...
  • Name & Summary Matched: ...
  • Name Matched: ...
  • Summary Matched: ...

Header of the section will be correctly denote its content.
examples:
* Name Exactly Matched: ...
* Name & Summary Matched: ...
* Name Matched: ...
* Summary Matched: ...
@jrohel jrohel force-pushed the fix/search_section_headers branch from b2a8b2c to dcc3921 Compare April 21, 2017 13:08
@jrohel jrohel force-pushed the fix/search_section_headers branch 2 times, most recently from 8c5e140 to 43d9293 Compare April 24, 2017 06:20
@jrohel
Copy link
Contributor Author

jrohel commented Apr 24, 2017

Test this please

@piotrdrag
Copy link
Contributor

Do I understand correctly that this causes, for example, “Name” to be concatenated with “Matched”, displaying “Name Matched” in the UI? If so, then it makes i18n very difficult for many languages: https://wiki.gnome.org/TranslationProject/DevGuidelines/Never%20split%20sentences

@jrohel
Copy link
Contributor Author

jrohel commented Apr 25, 2017

Do I understand correctly that this causes, for example, “Name” to be concatenated with “Matched”, displaying “Name Matched” in the UI?

  1. Set of attributes (name, summary, description, url) is transated. (Translation of this attributes exists in dnf for some time)

  2. There are 2 messages for translation: '%s Exactly Matched: %%s' and '%s Matched: %%s'.
    %s is replaced by set of translated attributes (for English: Name, Summary, Name & Summary, ...)
    %%s is replaced by found keywords
    So, order of words is defined by translators.
    For better translation I can make change. I can use plural forms (number of attributes will be used as parameter).
    Eg. this will be possible: P_("Attribute %s contains: %%s", "Attributes %s contain: %%s", num_of_attrs)
    I can change attributes separator '&' to another char, If you have better idea.

  3. And finally. Yes. I can change code and prepare message for every combination of attributes and text Matched/Exactly Matched. It is 32 combinations/messages now. Where is the limit for using static messages. 20, 100, 1000 ...
    This is what you want?

Examples of generated group headers in English:

================ Name Matched: clang, analyzer =================
================= Name Exactly Matched: clang ==================
================ Name & Summary Matched: clang =================
========= Description & Name Matched: clang, analyzer ==========
============== Description & Name Matched: clang ===============
===== Summary & Name & Description & URL Matched: analyzer =====
========= Summary & Name & Description Matched: clang ==========
============ Summary & Name & URL Matched: analyzer ============

...

@piotrdrag
Copy link
Contributor

piotrdrag commented Apr 25, 2017

OK, so it’d work for languages other than English if you:

@jrohel jrohel added the blocked label Apr 26, 2017
@j-mracek
Copy link
Member

j-mracek commented May 3, 2017

@dnf-bot r+

@dnf-bot
Copy link
Member

dnf-bot commented May 3, 2017

📌 Commit 9130a98 has been approved by j-mracek

@dnf-bot
Copy link
Member

dnf-bot commented May 3, 2017

⌛ Testing commit 9130a98 with merge ef436ec...

@dnf-bot
Copy link
Member

dnf-bot commented May 3, 2017

☀️ Test successful - status-jenkins
Approved by: j-mracek
Pushing ef436ec to master...

@dnf-bot dnf-bot closed this in ef436ec May 3, 2017
@piotrdrag
Copy link
Contributor

It’s much improved now, thanks!

Any chance of using C_( ) for the attributes?

@jrohel
Copy link
Contributor Author

jrohel commented May 4, 2017

Any chance of using C_( ) for the attributes?

DNF code (Python) uses only two functions for translation now. _() - gettext() and P_() - ngettext().
The translation with context C_() isn't supported in DNF. So I think that using C_() for attributes is not possible until C_() is not implemented.

mhatina pushed a commit to mhatina/dnf that referenced this pull request May 11, 2017
Header of the section will be correctly denote its content.
examples:
* Name Exactly Matched: ...
* Name & Summary Matched: ...
* Name Matched: ...
* Summary Matched: ...

Closes: rpm-software-management#792
Approved by: j-mracek
mhatina pushed a commit to mhatina/dnf that referenced this pull request May 11, 2017
Header of the section will be correctly denote its content.
examples:
* Name Exactly Matched: ...
* Name & Summary Matched: ...
* Name Matched: ...
* Summary Matched: ...

Closes: rpm-software-management#792
Approved by: j-mracek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants