My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

multi_language.h 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /********************
  2. * multi_language.h *
  3. ********************/
  4. /****************************************************************************
  5. * Written By Marcio Teixeira 2019 - Aleph Objects, Inc. *
  6. * *
  7. * This program is free software: you can redistribute it and/or modify *
  8. * it under the terms of the GNU General Public License as published by *
  9. * the Free Software Foundation, either version 3 of the License, or *
  10. * (at your option) any later version. *
  11. * *
  12. * This program is distributed in the hope that it will be useful, *
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15. * GNU General Public License for more details. *
  16. * *
  17. * To view a copy of the GNU General Public License, go to the following *
  18. * location: <https://www.gnu.org/licenses/>. *
  19. ****************************************************************************/
  20. #pragma once
  21. typedef const char Language_Str[];
  22. #ifdef LCD_LANGUAGE_5
  23. #define NUM_LANGUAGES 5
  24. #elif defined(LCD_LANGUAGE_4)
  25. #define NUM_LANGUAGES 4
  26. #elif defined(LCD_LANGUAGE_3)
  27. #define NUM_LANGUAGES 3
  28. #elif defined(LCD_LANGUAGE_2)
  29. #define NUM_LANGUAGES 2
  30. #else
  31. #define NUM_LANGUAGES 1
  32. #endif
  33. // Setting the unused languages equal to each other allows
  34. // the compiler to optimize away the conditionals
  35. #ifndef LCD_LANGUAGE_2
  36. #define LCD_LANGUAGE_2 LCD_LANGUAGE
  37. #endif
  38. #ifndef LCD_LANGUAGE_3
  39. #define LCD_LANGUAGE_3 LCD_LANGUAGE_2
  40. #endif
  41. #ifndef LCD_LANGUAGE_4
  42. #define LCD_LANGUAGE_4 LCD_LANGUAGE_3
  43. #endif
  44. #ifndef LCD_LANGUAGE_5
  45. #define LCD_LANGUAGE_5 LCD_LANGUAGE_4
  46. #endif
  47. #define _GET_LANG(LANG) Language_##LANG
  48. #define GET_LANG(LANG) _GET_LANG(LANG)
  49. #if NUM_LANGUAGES > 1
  50. extern uint8_t lang;
  51. #define GET_TEXT(MSG) ( \
  52. lang == 0 ? GET_LANG(LCD_LANGUAGE)::MSG : \
  53. lang == 1 ? GET_LANG(LCD_LANGUAGE_2)::MSG : \
  54. lang == 2 ? GET_LANG(LCD_LANGUAGE_3)::MSG : \
  55. lang == 3 ? GET_LANG(LCD_LANGUAGE_4)::MSG : \
  56. GET_LANG(LCD_LANGUAGE_5)::MSG \
  57. )
  58. #define MAX_LANG_CHARSIZE _MAX(GET_LANG(LCD_LANGUAGE)::CHARSIZE, \
  59. GET_LANG(LCD_LANGUAGE_2)::CHARSIZE, \
  60. GET_LANG(LCD_LANGUAGE_3)::CHARSIZE, \
  61. GET_LANG(LCD_LANGUAGE_4)::CHARSIZE, \
  62. GET_LANG(LCD_LANGUAGE_5)::CHARSIZE)
  63. #else
  64. #define GET_TEXT(MSG) GET_LANG(LCD_LANGUAGE)::MSG
  65. #define MAX_LANG_CHARSIZE GET_LANG(LCD_LANGUAGE)::CHARSIZE
  66. #endif
  67. #define GET_TEXT_F(MSG) (const __FlashStringHelper*)GET_TEXT(MSG)
  68. #define GET_LANGUAGE_NAME(INDEX) GET_LANG(LCD_LANGUAGE_##INDEX)::LANGUAGE
  69. #define MSG_1_LINE(A) A "\0" "\0"
  70. #define MSG_2_LINE(A,B) A "\0" B "\0"
  71. #define MSG_3_LINE(A,B,C) A "\0" B "\0" C