PageRenderTime 56ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llagentlanguage.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 75 lines | 34 code | 8 blank | 33 comment | 2 complexity | 5d2eed9519bb294686bcb2ce0a7ae65e MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llagentlanguage.cpp
  3. * @brief Transmit language information to server
  4. *
  5. * $LicenseInfo:firstyear=2006&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #include "llviewerprecompiledheaders.h"
  27. #include "llagentlanguage.h"
  28. // viewer includes
  29. #include "llagent.h"
  30. #include "llviewercontrol.h"
  31. #include "llviewerregion.h"
  32. // library includes
  33. #include "llui.h" // getLanguage()
  34. // static
  35. void LLAgentLanguage::init()
  36. {
  37. gSavedSettings.getControl("Language")->getSignal()->connect(boost::bind(&onChange));
  38. gSavedSettings.getControl("InstallLanguage")->getSignal()->connect(boost::bind(&onChange));
  39. gSavedSettings.getControl("SystemLanguage")->getSignal()->connect(boost::bind(&onChange));
  40. gSavedSettings.getControl("LanguageIsPublic")->getSignal()->connect(boost::bind(&onChange));
  41. }
  42. // static
  43. void LLAgentLanguage::onChange()
  44. {
  45. // Clear inventory cache so that default names of inventory items
  46. // appear retranslated (EXT-8308).
  47. gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE);
  48. }
  49. // send language settings to the sim
  50. // static
  51. bool LLAgentLanguage::update()
  52. {
  53. LLSD body;
  54. std::string url;
  55. if (gAgent.getRegion())
  56. {
  57. url = gAgent.getRegion()->getCapability("UpdateAgentLanguage");
  58. }
  59. if (!url.empty())
  60. {
  61. std::string language = LLUI::getLanguage();
  62. body["language"] = language;
  63. body["language_is_public"] = gSavedSettings.getBOOL("LanguageIsPublic");
  64. LLHTTPClient::post(url, body, new LLHTTPClient::Responder);
  65. }
  66. return true;
  67. }