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

Duplication of search categories names in two files #1841

Open
pastk opened this issue Jan 12, 2022 · 2 comments
Open

Duplication of search categories names in two files #1841

pastk opened this issue Jan 12, 2022 · 2 comments
Labels
Refactoring Search Search Translations Localization and translations issues

Comments

@pastk
Copy link
Contributor

pastk commented Jan 12, 2022

At the moment search categories localized names are taken from data/strings/strings.txt, e.g. [eat] definition for "Where to eat".

At the same time search synonyms for those categories are defined in data/categories.txt, e.g. in @ear supercategory.

The problem is that the name from strings.txt must be present amongst synonyms in categories.txt, otherwise category search won't work, hence its easy to break it when e.g. someone updates translations in strings.txt.

One approach to solve it is to refactor the code so that category names are not taken from strings.txt, but a first synonym from categories.txt is used instead.

Another, more radical approach, is to get rid of special categories.txt format and merge it into types_strings.txt (see #1644 (comment)).

Original discussions (in Russian): #1830 and #1834

@biodranik
Copy link
Member

Moving the current categories.txt parser into twine (to support strings.txt format) may not be worth it. But properly implementing two things can make the life of everyone easier:

  1. Add a method to get the first translated category synonym from the C++ core and use it in iOS and Android (e.g. GetSearchCategoryTranslation("@eat"). Then there will be no duplication.
  2. Search engine also matches types translations from strings.txt if they are referenced in categories.txt. Categories.txt references searchable types and optionally adds some search synonyms.

A more radical approach could be to move translations of all types into the categories.txt file, and somehow mark searchable/not searchable types there. That approach also avoids duplication and makes it easier to remember the default type translation for synonyms.

@biodranik biodranik added Refactoring Search Search Translations Localization and translations issues labels Jan 12, 2022
@pastk
Copy link
Contributor Author

pastk commented Jan 12, 2022

A more radical approach could be to move translations of all types into the categories.txt file, and somehow mark searchable/not searchable types there. That approach also avoids duplication and makes it easier to remember the default type translation for synonyms.

This idea is similar to merging categories.txt into types_strings.txt. But we'll end up with two distinct file formats to support still whereas we can rule them all with just one :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactoring Search Search Translations Localization and translations issues
Projects
None yet
Development

No branches or pull requests

2 participants