My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

multi_language.h 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /*******************************************************
  24. * multi_language.h *
  25. * By Marcio Teixeira 2019 for Aleph Objects *
  26. *******************************************************/
  27. #include "../inc/MarlinConfigPre.h"
  28. typedef const char Language_Str[];
  29. #define LSTR PROGMEM Language_Str
  30. #ifdef LCD_LANGUAGE_5
  31. #define NUM_LANGUAGES 5
  32. #elif defined(LCD_LANGUAGE_4)
  33. #define NUM_LANGUAGES 4
  34. #elif defined(LCD_LANGUAGE_3)
  35. #define NUM_LANGUAGES 3
  36. #elif defined(LCD_LANGUAGE_2)
  37. #define NUM_LANGUAGES 2
  38. #else
  39. #define NUM_LANGUAGES 1
  40. #endif
  41. // Set unused languages equal to each other so the
  42. // compiler can optimize away the conditionals.
  43. #define LCD_LANGUAGE_1 LCD_LANGUAGE
  44. #ifndef LCD_LANGUAGE_2
  45. #define LCD_LANGUAGE_2 LCD_LANGUAGE
  46. #endif
  47. #ifndef LCD_LANGUAGE_3
  48. #define LCD_LANGUAGE_3 LCD_LANGUAGE_2
  49. #endif
  50. #ifndef LCD_LANGUAGE_4
  51. #define LCD_LANGUAGE_4 LCD_LANGUAGE_3
  52. #endif
  53. #ifndef LCD_LANGUAGE_5
  54. #define LCD_LANGUAGE_5 LCD_LANGUAGE_4
  55. #endif
  56. #define _GET_LANG(LANG) Language_##LANG
  57. #define GET_LANG(LANG) _GET_LANG(LANG)
  58. #if NUM_LANGUAGES > 1
  59. #define HAS_MULTI_LANGUAGE 1
  60. #define GET_TEXT(MSG) ( \
  61. ui.language == 4 ? GET_LANG(LCD_LANGUAGE_5)::MSG : \
  62. ui.language == 3 ? GET_LANG(LCD_LANGUAGE_4)::MSG : \
  63. ui.language == 2 ? GET_LANG(LCD_LANGUAGE_3)::MSG : \
  64. ui.language == 1 ? GET_LANG(LCD_LANGUAGE_2)::MSG : \
  65. GET_LANG(LCD_LANGUAGE )::MSG )
  66. #define MAX_LANG_CHARSIZE _MAX(GET_LANG(LCD_LANGUAGE )::CHARSIZE, \
  67. GET_LANG(LCD_LANGUAGE_2)::CHARSIZE, \
  68. GET_LANG(LCD_LANGUAGE_3)::CHARSIZE, \
  69. GET_LANG(LCD_LANGUAGE_4)::CHARSIZE, \
  70. GET_LANG(LCD_LANGUAGE_5)::CHARSIZE )
  71. #else
  72. #define GET_TEXT(MSG) GET_LANG(LCD_LANGUAGE)::MSG
  73. #define MAX_LANG_CHARSIZE LANG_CHARSIZE
  74. #endif
  75. #define GET_TEXT_F(MSG) FPSTR(GET_TEXT(MSG))
  76. #define GET_EN_TEXT(MSG) GET_LANG(en)::MSG
  77. #define GET_EN_TEXT_F(MSG) FPSTR(GET_EN_TEXT(MSG))
  78. #define GET_LANGUAGE_NAME(INDEX) GET_LANG(LCD_LANGUAGE_##INDEX)::LANGUAGE
  79. #define LANG_CHARSIZE GET_TEXT(CHARSIZE)
  80. #define USE_WIDE_GLYPH (LANG_CHARSIZE > 2)
  81. #define MSG_1_LINE(A) A "\0" "\0"
  82. #define MSG_2_LINE(A,B) A "\0" B "\0"
  83. #define MSG_3_LINE(A,B,C) A "\0" B "\0" C