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

Fix broken list of languages available #51219

Merged
merged 1 commit into from
Sep 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,12 +1017,10 @@ std::unordered_set<std::string> options_manager::get_langs_with_translation_file
const std::string start_str = locale_dir();
std::vector<std::string> lang_dirs =
get_directories_with( PATH_INFO::lang_file(), start_str, true );
const std::size_t start_len = start_str.length();
const std::string end_str = "/LC_MESSAGES";
std::for_each( lang_dirs.begin(), lang_dirs.end(), [&]( std::string & dir ) {
const std::size_t start = dir.find( start_str ) + start_len + 1;
const std::size_t len = dir.rfind( end_str ) - start;
dir = dir.substr( start, len );
const std::size_t end = dir.rfind( "/LC_MESSAGES" );
const std::size_t begin = dir.rfind( '/', end - 1 ) + 1;
dir = dir.substr( begin, end - begin );
} );
return std::unordered_set<std::string>( lang_dirs.begin(), lang_dirs.end() );
#else // !LOCALIZE
Expand Down