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
list_keyboards
sets skipTerritory
, but never uses it
#18
Comments
Thank you very much! Currently that makes no difference, but it could make a difference in future. When more specific information is already available in _languages_db for a combination of languageId+'_'+scriptId+'_'+territoryId
languageId+'_'+scriptId
languageId+'_'+territoryId then the less specific information in _territories_db should be ignored. For example, list_inputmethods() already used skipTerritory correctly. If I disable that like this: diff --git a/langtable/langtable.py b/langtable/langtable.py
index 7e36c50..32eb5a3 100644
--- a/langtable/langtable.py
+++ b/langtable/langtable.py
@@ -2119,7 +2119,7 @@ def list_inputmethods(concise=True, show_weights=False, languageId = None, scrip
ranked_inputmethods[inputmethod] *= extra_bonus
ranked_inputmethods[inputmethod] *= language_bonus
territory_bonus = 1
- if territoryId in _territories_db and not skipTerritory:
+ if territoryId in _territories_db:# and not skipTerritory:
for inputmethod in _territories_db[territoryId].inputmethods:
if _territories_db[territoryId].inputmethods[inputmethod] != 0:
if inputmethod not in ranked_inputmethods: then this test case fails:
I.e. even though So the fallback to territoryId should not be used if more specific information was found earlier. |
The
list_keyboards
function inlangtable.py
has a variable calledskipTerritory
that gets set if the language DB has an entry for the combined languageId, scriptId and territoryId or combined languageId and territoryId, but it is never used. We always go down theif territoryId in _territories_db:
path, regardless of whetherskipTerritory
isTrue
orFalse
.I'd send a PR for this, but I'm not sure if the desired fix would be to skip the territory path if
skipTerritory
isTrue
, or remove the setting ofskipTerritory
entirely.The text was updated successfully, but these errors were encountered: