Anki is a smart spaced repetition flashcard program
Find a file
GithubAnon0000 e32292585b
FIX lang selection resetting to en_US for some langs (#3744)
* FIX lang selection resetting to en_US for some langs

Fixes https://forums.ankiweb.net/t/anki-25-01-beta/54490/17?u=anon_0000.

# Issue
Set a hand full of certain languages in the preferences screen and see that the translations have been applied after reboot. The language selection in preferences wrongly shows en_US though, not the current active language. If you wanted to switch to `en_US` in this case, then you'd have to first switch to a working language (like de_DE) and then switch to en_US.

# Solution
`anki/qt/aqt/preferences.py` has the functions `setup_language()` and `current_lang_index()`. I noticed that it defaults to en_US, if the language is not in `compatMap` and it couldn’t return the index of the current language. No idea if this code is faulty but I headed over to `anki/pylib/anki/lang.py` afterwards.

Here, in `compatMap`, I added e.g. `"la": "la_LA"`. I knew the code since I could get it with `print("––– lang is ", lang)` in `preferences.py` (`current_lang_index()` retrieves `la` for latin).

After adding those code changes from my PR, the problem for those selected languages had gone away.

No idea if that's best practices though or if something else should be fixed instead.

* UPDATE CONTRIBUTORS adding myself to the list
2025-01-25 19:14:50 +11:00
.buildkite Unify AMD and ARM Docker images 2025-01-17 16:03:17 +11:00
.cargo Switch to SvelteKit (#3077) 2024-03-31 09:16:31 +01:00
.config Drop workspace-hack in favor of workspace deps 2023-06-23 17:41:31 +10:00
.github/ISSUE_TEMPLATE Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
.vscode.dist HMR on Windows (#3144) 2024-04-17 21:23:34 +10:00
build Ensure sveltekit gets built before congrats page 2025-01-24 18:32:19 +11:00
cargo Update to FSRS-rs v2.0.2 (L2 regularization) (#3737) 2025-01-18 16:43:53 +11:00
docs Introduce PUID and PGID env variables to syncserver Dockerfile (#3714) 2025-01-25 18:19:38 +11:00
ftl Add percentage to FSRS spinner (#3679) 2025-01-25 18:17:02 +11:00
proto Remove unused proto import 2025-01-12 12:58:17 +11:00
pylib FIX lang selection resetting to en_US for some langs (#3744) 2025-01-25 19:14:50 +11:00
python More CVE dep updates 2025-01-09 23:38:51 +11:00
qt Allow reopening the add cards window (#3756) 2025-01-25 09:54:10 +03:00
rslib Recognise and check for media referenced in <source> tags (#3763) 2025-01-25 10:16:24 +03:00
tools Remove run-lin/win 2025-01-13 15:51:44 +11:00
ts fix changes to tags not being reflected when editing in io mode (#3768) 2025-01-25 10:36:21 +03:00
.deny.toml Allow Unicode-3 license 2024-07-20 18:07:06 +07:00
.dockerignore Add distroless Dockerfile and implement internal health check (#3366) 2024-08-29 17:05:33 +07:00
.dprint.json Switch back to Prettier for Svelte formatting 2025-01-13 15:53:55 +11:00
.eslintrc.cjs Include error message text on page 2024-06-24 15:35:47 +07:00
.gitattributes try again to improve GitHub's language stats 2021-01-20 13:20:45 +10:00
.gitignore chore: add mypy's cache to .gitignore file (#3360) 2024-08-17 13:09:30 +07:00
.gitmodules Exclude PyOxidizer from recursive checkout 2023-07-02 18:22:44 +10:00
.isort.cfg Specify Python version for auto-formatters (#3325) 2024-08-04 20:54:14 +07:00
.mypy.ini Enable strict_optional for aqt/tagedit, utils, sync (#3578) 2024-11-15 16:29:19 +03:00
.prettierrc Switch back to Prettier for Svelte formatting 2025-01-13 15:53:55 +11:00
.pylintrc Add ability to restore a notetype to its original configuration (#2472) 2023-04-18 14:07:51 +10:00
.ruff.toml Specify Python version for auto-formatters (#3325) 2024-08-04 20:54:14 +07:00
.rustfmt-empty.toml Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
.rustfmt.toml Move ascii_percent_encoding into a separate repo 2023-04-12 08:45:23 +10:00
.version Bump version 2025-01-17 16:03:17 +11:00
Cargo.lock Update to FSRS-rs v2.0.2 (L2 regularization) (#3737) 2025-01-18 16:43:53 +11:00
Cargo.toml Update to FSRS-rs v2.0.2 (L2 regularization) (#3737) 2025-01-18 16:43:53 +11:00
check Add a shortcut to auto-format before running checks 2023-07-02 09:59:05 +10:00
CONTRIBUTORS FIX lang selection resetting to en_US for some langs (#3744) 2025-01-25 19:14:50 +11:00
LICENSE Replace css_browser_selector with our own implementation (#2854) 2023-11-30 10:57:33 +10:00
ninja Switch to SvelteKit (#3077) 2024-03-31 09:16:31 +01:00
package.json Switch back to Prettier for Svelte formatting 2025-01-13 15:53:55 +11:00
pkgkey.asc add public key for release signing 2018-09-18 10:40:45 +10:00
pyproject.toml chore: add initial configuration for pyright (#3361) 2024-08-17 13:10:02 +07:00
README.md Updated README (#2718) 2023-10-11 14:11:07 +10:00
run Fix webengine remote debugging in Qt6 2023-11-05 12:41:17 +10:00
run.bat HMR on Windows (#3144) 2024-04-17 21:23:34 +10:00
rust-toolchain.toml Rust 1.82 2024-10-26 20:02:53 +10:00
SECURITY.md add SECURITY.md 2021-09-22 22:55:19 +10:00
yarn Switch to SvelteKit (#3077) 2024-03-31 09:16:31 +01:00
yarn.bat Switch to SvelteKit (#3077) 2024-03-31 09:16:31 +01:00
yarn.lock Use only newer vite version 2025-01-24 18:36:38 +11:00

Anki

Build status

This repo contains the source code for the computer version of Anki.

About

Anki is a spaced repetition program. Please see the website to learn more.

Getting Started

Anki Betas

If you'd like to try development builds of Anki but don't feel comfortable building the code, please see Anki betas

Developing

For more information on building and developing, please see Development.

Contributing

Want to contribute to Anki? Check out the Contribution Guidelines.

Anki Contributors

CONTRIBUTORS

License

Anki's license: LICENSE