Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
c0afc3ab
Commit
c0afc3ab
authored
2 years ago
by
Aline Gondim Santos
Browse files
Options
Downloads
Patches
Plain Diff
plugins: avoid getting system language every time
GitLab:
#780
Change-Id: I50e5dff097c4573f24f9ba6c25fa38e2857479ae
parent
8e0c0925
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugin/pluginpreferencesutils.cpp
+16
-3
16 additions, 3 deletions
src/plugin/pluginpreferencesutils.cpp
with
16 additions
and
3 deletions
src/plugin/pluginpreferencesutils.cpp
+
16
−
3
View file @
c0afc3ab
...
...
@@ -163,7 +163,7 @@ PluginPreferencesUtils::getPreferences(const std::string& rootPath, const std::s
if
(
auto
envLang
=
std
::
getenv
(
"JAMI_LANG"
))
lang
=
envLang
;
else
JAMI_
ERR
()
<<
"Error getting JAMI_LANG env, trying to get system language"
;
JAMI_
INFO
()
<<
"Error getting JAMI_LANG env, trying to get system language"
;
// If language preference is empty, try to get from the system.
if
(
lang
.
empty
())
{
#ifdef WIN32
...
...
@@ -182,9 +182,22 @@ PluginPreferencesUtils::getPreferences(const std::string& rootPath, const std::s
lang
.
append
(
utf8Buffer
);
string_replace
(
lang
,
"-"
,
"_"
);
}
// Even though we default to the system variable in windows, technically this
// part of the code should not be reached because the client-qt must define that
// variable and we cannot run the client and the daemon in diferent processes in Windows.
#else
// For Android this should not work since std::locale is not supported by the NDK.
lang
=
std
::
locale
(
""
).
name
();
// The same way described in the comment just above, the android should not reach this
// part of the code given the client-android must define "JAMI_LANG" system variable.
// And even if this part is reached, it should not work since std::locale is not
// supported by the NDK.
// LC_COLLATE is used to grab the locale for the case when the system user has set different
// values for the preferred Language and Format.
lang
=
setlocale
(
LC_COLLATE
,
""
);
// We set the environment to avoid checking from system everytime.
// This is the case when running daemon and client in different processes
// like with dbus.
setenv
(
"JAMI_LANG"
,
lang
.
c_str
(),
1
);
#endif // WIN32
}
auto
locales
=
getLocales
(
rootPath
,
std
::
string
(
string_remove_suffix
(
lang
,
'.'
)));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment