translate.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Original Name: src/common/intl.cpp
  3. // Original Purpose: Internationalization and localisation for wxWidgets
  4. // Original Author: Vadim Zeitlin
  5. // Modified by: Charlie Fenton for BOINC 13 June, 2013
  6. // Created: 29/01/98
  7. // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. //
  11. // This file is part of BOINC.
  12. // http://boinc.berkeley.edu
  13. //
  14. // Simplified string localization code for use in BOINC adapted from
  15. // wxWidgets src/common/intl.cpp.
  16. //
  17. // For sample code to get preferred system language, see
  18. // wxLocale::GetSystemLanguage() in wxWidgets src/common/intl.cpp
  19. //
  20. // Those portions of this code which are taken from wxWidgets are
  21. // Copyright: (c) 1998 Vadim Zeitlin
  22. // and are covered by the wxWidgets license which can be found here:
  23. // <http://www.wxwidgets.org/about/licence3.txt>
  24. //
  25. // This code assumes all catalogs are encoded UTF-8
  26. // (Note: wxstd.mo files are encoded ISO 8859-1 not UTF-8.)
  27. //
  28. // We recommended that you first call BOINCTranslationAddCatalog()
  29. // for the user's preferred language, then for the user's second
  30. // preferred language and (optionally) then for the user's third
  31. // preferred language. This will make it more likley that a
  32. // translation will be found in some language useful to the user.
  33. //
  34. #ifndef BOINC_TRANSLATE_H
  35. #define BOINC_TRANSLATE_H
  36. // We use only C APIs for maximum portability
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. void BOINCTranslationInit();
  41. // catalogsDir is the path to the locale directory in
  42. // the BOINC Data directory (ending in "locale/").
  43. //
  44. // language code is the standad language code such
  45. // as "fr" or "zh_CN".
  46. //
  47. // catalogName is the domain (the file name of the
  48. // *.mo file without the .mo such as "BOINC-Manager").
  49. //
  50. // Returns true if successful.
  51. //
  52. bool BOINCTranslationAddCatalog(const char * catalogsDir,
  53. const char *languageCode,
  54. const char * catalogName
  55. );
  56. // Searches through the catalogs in the order they were added
  57. // until it finds a translation for the src string, and
  58. // returns a ponter to the UTF-8 encoded localized string.
  59. // Returns a pointer to the original string if no translation
  60. // was found.
  61. //
  62. uint8_t * _(char *src);
  63. void BOINCTranslationCleanup();
  64. #ifdef __cplusplus
  65. } // extern "C" {
  66. #endif
  67. #endif // BOINC_TRANSLATE_H