Jinoh Kang (@iamahuman) commented about dlls/windows.media.speech/unixlib.c:
+ while ((dirent = readdir(dir))) + { + if (dirent->d_type != DT_DIR) + continue; + + dir_name = dirent->d_name; + + if (!strncmp(dir_name, vosk_model_identifier_small, ident_small_len)) + dir_name += ident_small_len; + else if (!strncmp(dir_name, vosk_model_identifier, ident_len)) + dir_name += ident_len; + else + continue; + + /* First match for lang and region (en-us), then only lang (en). */ + if (strncmp(dir_name, locale, len) && strncmp(dir_name, locale, str - locale)) If the `en-gb` model comes before the `en-us` model in the directory, `en-gb` will match the lang part (`en`) and `find_model_by_locale_and_path` will proceed with it.
Note that the `strncmp(dir_name, locale, len) && ` part can be omitted since lang-region match _implies_ lang match, and lang mismatch _implies_ lang-region mismatch. Do you mind explaining how it worked for your case? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2091#note_26154