2021-09-20 01:40:56 +02:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
2019-10-10 02:46:10 +02:00
|
|
|
#pragma once
|
|
|
|
|
2021-09-20 01:40:56 +02:00
|
|
|
/*******************************************************
|
|
|
|
* multi_language.h *
|
|
|
|
* By Marcio Teixeira 2019 for Aleph Objects *
|
|
|
|
*******************************************************/
|
|
|
|
|
2021-01-21 01:52:06 +01:00
|
|
|
#include "../inc/MarlinConfigPre.h"
|
|
|
|
|
2019-10-10 02:46:10 +02:00
|
|
|
typedef const char Language_Str[];
|
2021-09-20 01:40:56 +02:00
|
|
|
#define LSTR PROGMEM Language_Str
|
2019-10-10 02:46:10 +02:00
|
|
|
|
2020-04-27 15:27:14 +02:00
|
|
|
#ifdef LCD_LANGUAGE_5
|
2019-10-10 02:46:10 +02:00
|
|
|
#define NUM_LANGUAGES 5
|
|
|
|
#elif defined(LCD_LANGUAGE_4)
|
|
|
|
#define NUM_LANGUAGES 4
|
|
|
|
#elif defined(LCD_LANGUAGE_3)
|
|
|
|
#define NUM_LANGUAGES 3
|
|
|
|
#elif defined(LCD_LANGUAGE_2)
|
|
|
|
#define NUM_LANGUAGES 2
|
|
|
|
#else
|
|
|
|
#define NUM_LANGUAGES 1
|
|
|
|
#endif
|
|
|
|
|
2021-08-30 03:52:48 +02:00
|
|
|
// Set unused languages equal to each other so the
|
|
|
|
// compiler can optimize away the conditionals.
|
2019-10-10 02:46:10 +02:00
|
|
|
#ifndef LCD_LANGUAGE_2
|
|
|
|
#define LCD_LANGUAGE_2 LCD_LANGUAGE
|
|
|
|
#endif
|
|
|
|
#ifndef LCD_LANGUAGE_3
|
|
|
|
#define LCD_LANGUAGE_3 LCD_LANGUAGE_2
|
|
|
|
#endif
|
|
|
|
#ifndef LCD_LANGUAGE_4
|
|
|
|
#define LCD_LANGUAGE_4 LCD_LANGUAGE_3
|
|
|
|
#endif
|
|
|
|
#ifndef LCD_LANGUAGE_5
|
|
|
|
#define LCD_LANGUAGE_5 LCD_LANGUAGE_4
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define _GET_LANG(LANG) Language_##LANG
|
|
|
|
#define GET_LANG(LANG) _GET_LANG(LANG)
|
|
|
|
|
|
|
|
#if NUM_LANGUAGES > 1
|
2021-01-21 01:52:06 +01:00
|
|
|
#define HAS_MULTI_LANGUAGE 1
|
2019-10-10 02:46:10 +02:00
|
|
|
#define GET_TEXT(MSG) ( \
|
2021-08-30 03:52:48 +02:00
|
|
|
ui.language == 4 ? GET_LANG(LCD_LANGUAGE_5)::MSG : \
|
2021-01-21 01:52:06 +01:00
|
|
|
ui.language == 3 ? GET_LANG(LCD_LANGUAGE_4)::MSG : \
|
2021-08-30 03:52:48 +02:00
|
|
|
ui.language == 2 ? GET_LANG(LCD_LANGUAGE_3)::MSG : \
|
|
|
|
ui.language == 1 ? GET_LANG(LCD_LANGUAGE_2)::MSG : \
|
|
|
|
GET_LANG(LCD_LANGUAGE )::MSG )
|
2021-01-21 01:52:06 +01:00
|
|
|
#define MAX_LANG_CHARSIZE _MAX(GET_LANG(LCD_LANGUAGE )::CHARSIZE, \
|
|
|
|
GET_LANG(LCD_LANGUAGE_2)::CHARSIZE, \
|
|
|
|
GET_LANG(LCD_LANGUAGE_3)::CHARSIZE, \
|
|
|
|
GET_LANG(LCD_LANGUAGE_4)::CHARSIZE, \
|
|
|
|
GET_LANG(LCD_LANGUAGE_5)::CHARSIZE )
|
2019-10-10 02:46:10 +02:00
|
|
|
#else
|
|
|
|
#define GET_TEXT(MSG) GET_LANG(LCD_LANGUAGE)::MSG
|
2021-01-21 01:52:06 +01:00
|
|
|
#define MAX_LANG_CHARSIZE LANG_CHARSIZE
|
2019-10-10 02:46:10 +02:00
|
|
|
#endif
|
2021-09-25 09:27:07 +02:00
|
|
|
#define GET_TEXT_F(MSG) FPSTR(GET_TEXT(MSG))
|
2019-10-10 02:46:10 +02:00
|
|
|
|
2020-04-16 06:17:01 +02:00
|
|
|
#define GET_LANGUAGE_NAME(INDEX) GET_LANG(LCD_LANGUAGE_##INDEX)::LANGUAGE
|
2021-01-21 01:52:06 +01:00
|
|
|
#define LANG_CHARSIZE GET_TEXT(CHARSIZE)
|
|
|
|
#define USE_WIDE_GLYPH (LANG_CHARSIZE > 2)
|
2020-04-06 01:24:50 +02:00
|
|
|
|
|
|
|
#define MSG_1_LINE(A) A "\0" "\0"
|
|
|
|
#define MSG_2_LINE(A,B) A "\0" B "\0"
|
|
|
|
#define MSG_3_LINE(A,B,C) A "\0" B "\0" C
|