My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

language.cpp 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*****************
  2. * language.cpp *
  3. *****************/
  4. /****************************************************************************
  5. * Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
  6. * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
  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. * To view a copy of the GNU General Public License, go to the following *
  19. * location: <http://www.gnu.org/licenses/>. *
  20. ****************************************************************************/
  21. #include "../compat.h"
  22. #if ENABLED(LULZBOT_TOUCH_UI) && defined(TOUCH_UI_LANGUAGE_MENU)
  23. #include "language_de.h"
  24. #include "language_en.h"
  25. #include "language_fr.h"
  26. PROGMEM Language_List languages = {
  27. &Language_de::strings,
  28. &Language_en::strings,
  29. &Language_fr::strings
  30. };
  31. uint8_t get_language_count() {
  32. return sizeof(languages)/sizeof(languages[0]);
  33. }
  34. static uint8_t lang = 0;
  35. void set_language(uint8_t l) {
  36. lang = l;
  37. };
  38. const char *get_text(uint8_t lang, String_Indices index) {
  39. const Language_Strings* strings = (const Language_Strings*) pgm_read_ptr(&languages[lang]);
  40. return (const char *)pgm_read_ptr(&(*strings)[int(index)]);
  41. };
  42. const char *get_text(String_Indices index) {
  43. return get_text(lang, index);
  44. };
  45. #endif