Prusa MINI Firmware overview
Main Page
Modules
Classes
Files
File List
File Members
multi_language.h
Go to the documentation of this file.
1
/********************
2
* multi_language.h *
3
********************/
4
5
/****************************************************************************
6
* Written By Marcio Teixeira 2019 - 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
#pragma once
22
23
typedef
const
char
Language_Str
[];
24
25
#if defined(LCD_LANGUAGE_5)
26
#define NUM_LANGUAGES 5
27
#elif defined(LCD_LANGUAGE_4)
28
#define NUM_LANGUAGES 4
29
#elif defined(LCD_LANGUAGE_3)
30
#define NUM_LANGUAGES 3
31
#elif defined(LCD_LANGUAGE_2)
32
#define NUM_LANGUAGES 2
33
#else
34
#define NUM_LANGUAGES 1
35
#endif
36
37
// Setting the unused languages equal to each other allows
38
// the compiler to optimize away the conditionals
39
40
#ifndef LCD_LANGUAGE_2
41
#define LCD_LANGUAGE_2 LCD_LANGUAGE
42
#endif
43
44
#ifndef LCD_LANGUAGE_3
45
#define LCD_LANGUAGE_3 LCD_LANGUAGE_2
46
#endif
47
48
#ifndef LCD_LANGUAGE_4
49
#define LCD_LANGUAGE_4 LCD_LANGUAGE_3
50
#endif
51
52
#ifndef LCD_LANGUAGE_5
53
#define LCD_LANGUAGE_5 LCD_LANGUAGE_4
54
#endif
55
56
#define _GET_LANG(LANG) Language_##LANG
57
#define GET_LANG(LANG) _GET_LANG(LANG)
58
59
#if NUM_LANGUAGES > 1
60
extern
uint8_t
lang;
61
#define GET_TEXT(MSG) ( \
62
lang == 0 ? GET_LANG(LCD_LANGUAGE)::MSG : \
63
lang == 1 ? GET_LANG(LCD_LANGUAGE_2)::MSG : \
64
lang == 2 ? GET_LANG(LCD_LANGUAGE_3)::MSG : \
65
lang == 3 ? GET_LANG(LCD_LANGUAGE_4)::MSG : \
66
GET_LANG(LCD_LANGUAGE_5)::MSG \
67
)
68
#define MAX_LANG_CHARSIZE _MAX(GET_LANG(LCD_LANGUAGE)::CHARSIZE, \
69
GET_LANG(LCD_LANGUAGE_2)::CHARSIZE, \
70
GET_LANG(LCD_LANGUAGE_3)::CHARSIZE, \
71
GET_LANG(LCD_LANGUAGE_4)::CHARSIZE, \
72
GET_LANG(LCD_LANGUAGE_5)::CHARSIZE)
73
#else
74
#define GET_TEXT(MSG) GET_LANG(LCD_LANGUAGE)::MSG
75
#define MAX_LANG_CHARSIZE GET_LANG(LCD_LANGUAGE)::CHARSIZE
76
#endif
77
#define GET_TEXT_F(MSG) (const __FlashStringHelper*)GET_TEXT(MSG)
78
79
#define MSG_CONCAT(A,B) pgm_p_pair_t(GET_TEXT(A),GET_TEXT(B))
Language_Str
const typedef char Language_Str[]
Definition:
multi_language.h:21
uint8_t
const uint8_t[]
Definition:
404_html.c:3
Prusa-Firmware-Buddy-Private1
lib
Marlin
Marlin
src
core
multi_language.h
Generated by
1.8.16