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.

language.h 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**************
  2. * 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: <http://www.gnu.org/licenses/>. *
  19. ****************************************************************************/
  20. #pragma once
  21. enum class String_Indices { LANGUAGE_STRINGS, COUNT };
  22. typedef const char Language_Str[];
  23. typedef const char* const Language_Strings[int(String_Indices::COUNT)];
  24. typedef const Language_Strings* const Language_List[];
  25. #ifndef TOUCH_UI_LANGUAGE_MENU
  26. // Default mode, support only one language.
  27. #define __GET_TEXTF(MSG,LANG) Language_##LANG::MSG
  28. #define _GET_TEXTF(MSG,LANG) __GET_TEXTF(MSG,LANG)
  29. #define GET_TEXTF(MSG) reinterpret_cast<const __FlashStringHelper *>(_GET_TEXTF(MSG,LCD_LANGUAGE))
  30. #define GET_TEXT(MSG) _GET_TEXTF(MSG,LCD_LANGUAGE)
  31. #define MAKE_LANGUAGE_STRINGS()
  32. #else
  33. // Support multiple languages at run-time.
  34. uint8_t get_language_count();
  35. void set_language(uint8_t index);
  36. const char *get_text(String_Indices index);
  37. const char *get_text(uint8_t lang, String_Indices index);
  38. #define GET_TEXT(MSG) get_text(String_Indices::MSG)
  39. #define GET_TEXTF(MSG) reinterpret_cast<const __FlashStringHelper *>(get_text(String_Indices::MSG))
  40. #define MAKE_LANGUAGE_STRINGS() PROGMEM Language_Strings strings = { LANGUAGE_STRINGS }
  41. #endif