LonamiWebs / Stringlate

Android application to help in strings.xml translation
https://lonamiwebs.github.io/stringlate/index
MIT License
106 stars 48 forks source link

Stringlate's search for locales does not work properly #196

Closed Olf0 closed 6 years ago

Olf0 commented 6 years ago

Steps to reproduce

  1. Start Stringlate.
  2. Tap on an subscribed repository.
  3. Tap on the menu button ("︙") in the upper right corner.
  4. Tap on the menu entry, "+ Add new locale".
  5. Tap on the search field atop the list of offered locales.
  6. Entering DE or de does not find any of de-* locales, regardless of the position of the More switch.
  7. Entering EN or en with the More switch off (i.e. default state) finds many locales, whose locale strings do not contain "en", only their full names (e.g. French, Bena, Armenian).
  8. Multi-line input is possible (by entering the Return key) in the search field, which neither makes sense or works (always finds nothing, as soon as a second line is opened).

Expected behaviour

  1. The de-* locales are found, when searching for de or DE.
  2. Solely the locale strings proper are subjected to search pattern matching, when the More switch is off (default). Only if this switch is on, the locale's full names shall be also taken into account.
  3. No multiple lines can be entered (e.g. by ignoring Carriage Return (CR) characters) in the locale search field.

General information:

Tested with Stringlate 0.14 from F-Droid under AOSP 4.1.2 (API level 16).

gsantner commented 6 years ago

as far as I know thats because we apply the search filter to locale-name only, right @Lonami

Lonami commented 6 years ago

Indeed: https://github.com/LonamiWebs/Stringlate/blob/819bcdceab4579d72e4bc04a81e4cd51e9d3678f/src/app/src/main/java/io/github/lonamiwebs/stringlate/adapters/LocaleEntryAdapter.java#L138-L146

Lonami commented 6 years ago

Nice idea by the way :) this commit will prioritize these results to the top. Not everyone knows about country codes so that's why the default was to look in the display name.