Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: Shared/PluginClientBase.cpp

Issue 9843129: Always use the system language for the UI (Closed)
Patch Set: Created March 22, 2013, 2:59 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Shared/PluginUserSettings.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 // Internet / FTP 3 // Internet / FTP
4 #include <wininet.h> 4 #include <wininet.h>
5 5
6 // IP adapter 6 // IP adapter
7 #include <iphlpapi.h> 7 #include <iphlpapi.h>
8 8
9 #include "PluginSettings.h" 9 #include "PluginSettings.h"
10 #include "PluginSystem.h" 10 #include "PluginSystem.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 url.ReleaseBuffer(); 82 url.ReleaseBuffer();
83 url = unescapedUrl; 83 url = unescapedUrl;
84 } 84 }
85 85
86 return url; 86 return url;
87 } 87 }
88 88
89 89
90 void CPluginClientBase::SetLocalization() 90 void CPluginClientBase::SetLocalization()
91 { 91 {
92 CPluginDictionary* dic = CPluginDictionary::GetInstance();
93
94 CPluginSystem* system = CPluginSystem::GetInstance(); 92 CPluginSystem* system = CPluginSystem::GetInstance();
95
96 CString browserLanguage = system->GetBrowserLanguage(); 93 CString browserLanguage = system->GetBrowserLanguage();
97 94
95 CPluginDictionary* dic = CPluginDictionary::GetInstance();
96 dic->SetLanguage(browserLanguage);
97
98 CPluginSettings* settings = CPluginSettings::GetInstance(); 98 CPluginSettings* settings = CPluginSettings::GetInstance();
99 99 if (settings->IsMainProcess() && settings->IsMainThread() && !settings->Has(SE TTING_LANGUAGE))
100 if (settings->IsMainProcess() && settings->IsMainThread())
101 { 100 {
102 if (browserLanguage != settings->GetString(SETTING_LANGUAGE)) 101 settings->SetString(SETTING_LANGUAGE, browserLanguage);
Oleksandr 2013/03/22 16:04:14 What if we don't have the browser's version in the
Felix Dahlke 2013/03/22 16:09:18 Hehe, I've wondered quite a bit about this actuall
Oleksandr 2013/03/22 16:15:28 It isn't related, but it's not like we can have on
103 {
104 if (dic->IsLanguageSupported(browserLanguage))
105 {
106 //» » » settings->SetString(SETTING_LANGUAGE, browse rLanguage);
107 }
108 }
109
110 if (!settings->Has(SETTING_LANGUAGE))
111 {
112 settings->SetString(SETTING_LANGUAGE, "en");
113 }
114
115 settings->Write(); 102 settings->Write();
116 } 103 }
117
118 dic->SetLanguage(settings->GetString(SETTING_LANGUAGE));
119 } 104 }
120 105
121 106
122 void CPluginClientBase::LogPluginError(DWORD errorCode, int errorId, int errorSu bid, const CString& description, bool isAsync, DWORD dwProcessId, DWORD dwThread Id) 107 void CPluginClientBase::LogPluginError(DWORD errorCode, int errorId, int errorSu bid, const CString& description, bool isAsync, DWORD dwProcessId, DWORD dwThread Id)
123 { 108 {
124 // Prevent circular references 109 // Prevent circular references
125 if (CPluginSettings::HasInstance() && isAsync) 110 if (CPluginSettings::HasInstance() && isAsync)
126 { 111 {
127 DEBUG_ERROR_CODE_EX(errorCode, description, dwProcessId, dwThreadId); 112 DEBUG_ERROR_CODE_EX(errorCode, description, dwProcessId, dwThreadId);
128 113
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 { 224 {
240 m_criticalSectionWhitelist.Lock(); 225 m_criticalSectionWhitelist.Lock();
241 { 226 {
242 m_cacheWhitelistedUrls.clear(); 227 m_cacheWhitelistedUrls.clear();
243 } 228 }
244 m_criticalSectionWhitelist.Unlock(); 229 m_criticalSectionWhitelist.Unlock();
245 } 230 }
246 231
247 232
248 #endif // SUPPORT_WHITELIST 233 #endif // SUPPORT_WHITELIST
OLDNEW
« no previous file with comments | « no previous file | Shared/PluginUserSettings.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld