Skip to content

Commit cbd07c3

Browse files
author
jantje
committed
#661 use the arduino ide provided text
1 parent 29a46d7 commit cbd07c3

File tree

5 files changed

+114
-95
lines changed

5 files changed

+114
-95
lines changed

io.sloeber.core/src/io/sloeber/core/Messages.java

Lines changed: 92 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -3,113 +3,114 @@
33
import org.eclipse.osgi.util.NLS;
44

55
public class Messages extends NLS {
6-
private static final String BUNDLE_NAME = "io.sloeber.core.messages"; //$NON-NLS-1$
6+
private static final String BUNDLE_NAME = "io.sloeber.core.messages"; //$NON-NLS-1$
77
public static final String PORT_TAG = "{PORT}"; //$NON-NLS-1$
88
public static final String MENUITEMID_TAG = "{MENUITEMID}"; //$NON-NLS-1$
99
public static final String MENUID_TAG = "{MENUID}"; //$NON-NLS-1$
10-
public static final String BOARDID_TAG = "{BOARDID}"; //$NON-NLS-1$
11-
public static final String MENUITEMNAME_TAG = "{MENUITEMNAME}"; //$NON-NLS-1$
12-
public static final String LIB_TAG = "{LIB}"; //$NON-NLS-1$
13-
public static final String PROJECT_TAG = "{PROJECT}"; //$NON-NLS-1$
14-
public static final String UPLOADER_TAG = "{UPLOADER}"; //$NON-NLS-1$
15-
public static final String MS_TAG = "{MS}"; //$NON-NLS-1$
10+
public static final String BOARDID_TAG = "{BOARDID}"; //$NON-NLS-1$
11+
public static final String MENUITEMNAME_TAG = "{MENUITEMNAME}"; //$NON-NLS-1$
12+
public static final String LIB_TAG = "{LIB}"; //$NON-NLS-1$
13+
public static final String PROJECT_TAG = "{PROJECT}"; //$NON-NLS-1$
14+
public static final String UPLOADER_TAG = "{UPLOADER}"; //$NON-NLS-1$
15+
public static final String MS_TAG = "{MS}"; //$NON-NLS-1$
1616
public static final String NAME_TAG = "{NAME}"; //$NON-NLS-1$
1717
public static final String ID_TAG = "{ID}"; //$NON-NLS-1$
1818
public static final String COMMAND_TAG = "{COMMAND}"; //$NON-NLS-1$
19-
public static final String TOOL_TAG = "{TOOL}"; //$NON-NLS-1$
19+
public static final String TOOL_TAG = "{TOOL}"; //$NON-NLS-1$
2020
public static final String FILE_TAG = "{FILE}"; //$NON-NLS-1$
2121
public static final String BOARD_TAG = "{BOARD}"; //$NON-NLS-1$
2222
public static final String CONFIG_TAG = "{CONFIG}"; //$NON-NLS-1$
2323
public static final String KEY_TAG = "{KEY}"; //$NON-NLS-1$
2424
public static final String FOLDER_TAG = "{FOLDER}"; //$NON-NLS-1$
2525
public static final String VERSION_TAG = "{VERSION}"; //$NON-NLS-1$
2626
public static final String HOST_TAG = "{HOST}"; //$NON-NLS-1$
27-
28-
29-
public static String ArduinoSerial_Comport_Appeared_and_disappeared;
30-
public static String ArduinoSerial_Comport_is_not_behaving_as_expected;
31-
public static String ArduinoSerial_comport_not_found;
32-
public static String ArduinoSerial_Comport_reset_took;
33-
public static String ArduinoSerial_Continuing_to_use;
34-
public static String ArduinoSerial_Ending_reset;
35-
public static String ArduinoSerial_exception_while_opening_seral_port;
36-
public static String ArduinoSerial_port_reappeared;
37-
public static String ArduinoSerial_port_still_missing;
38-
public static String ArduinoSerial_reset_dtr_toggle;
39-
public static String ArduinoSerial_reset_failed;
40-
public static String ArduinoSerial_unable_to_open_serial_port;
41-
public static String ArduinoSerial_Using_1200bps_touch;
42-
public static String ArduinoSerial_Using_comport;
43-
public static String Boards_Failed_to_read_boards;
44-
public static String Boards_Get_menu_item_name_from_id_did_not_find;
45-
public static String Boards_menu_ID_not_found;
46-
public static String Boards_menu_name_not_found;
47-
public static String command_aborted;
48-
public static String command_finished;
49-
public static String command_interupted;
50-
public static String command_io;
51-
public static String command_launching;
52-
public static String command_output;
53-
public static String EmptyLibFolder;
54-
public static String Failed_To_Add_Libraries;
55-
public static String failed_to_remove_lib;
56-
public static String Boards_Get_menu_item_id_from_name_failed;
57-
public static String Helpers_Create_folder_failed;
58-
public static String Helpers_delete_folder_failed;
59-
public static String Helpers_error_boards_TXT;
60-
public static String Helpers_Error_File_does_not_exists;
61-
public static String Helpers_error_link_folder_is_empty;
62-
public static String Helpers_Error_parsing_IO_exception;
63-
public static String Helpers_Error_The_folder_is_empty;
64-
public static String Helpers_No_boards_txt_found;
65-
public static String Helpers_tool_reference_missing;
66-
public static String import_lib_failed;
67-
public static String Manager_archive_error_root_folder_name_mismatch;
68-
public static String Manager_archive_error_symbolic_link_to_absolute_path;
69-
public static String Manager_archiver_eror_single_root_folder_required;
70-
public static String Manager_Cant_create_folder;
71-
public static String Manager_Cant_create_folder_exists;
72-
public static String Manager_Cant_extract_file_exist;
73-
public static String Manager_Failed_to_download;
74-
public static String Manager_Failed_to_extract;
75-
public static String Manager_Failed_to_parse;
76-
public static String Manager_Format_not_supported;
77-
public static String MultipleVersionsOfLib;
78-
public static String Platform_loading_boards;
79-
public static String Platform_loading_platform;
80-
public static String security_login;
81-
public static String security_password;
82-
public static String Tool_no_valid_system;
83-
public static String ToolDependency_Tool_not_found;
84-
public static String Upload_console_name;
85-
public static String Upload_error_auth_fail;
86-
public static String Upload_Error_com_port;
87-
public static String Upload_error_connection_refused;
88-
public static String Upload_error_network;
89-
public static String Upload_Error_serial_monitor_restart;
90-
public static String Upload_failed;
91-
public static String Upload_failed_upload_file;
92-
public static String Upload_login_credentials_missing;
93-
public static String Upload_no_arduino_sketch;
94-
public static String Upload_Project_nature_unaccesible;
95-
public static String Upload_sending_sketch;
96-
public static String Upload_sketch_on_yun;
97-
public static String Upload_starting;
98-
public static String Upload_uploading;
99-
public static String uploader_Failed_to_get_upload_recipe;
100-
public static String uploader_no_reset_using_network;
101-
public static String uploader_no_reset_using_programmer;
102-
public static String BoardsManagerIsBussy;
103-
public static String No_Platform_available ;
27+
28+
public static String ArduinoSerial_Comport_Appeared_and_disappeared;
29+
public static String ArduinoSerial_Comport_is_not_behaving_as_expected;
30+
public static String ArduinoSerial_comport_not_found;
31+
public static String ArduinoSerial_Comport_reset_took;
32+
public static String ArduinoSerial_Continuing_to_use;
33+
public static String ArduinoSerial_Ending_reset;
34+
public static String ArduinoSerial_exception_while_opening_seral_port;
35+
public static String ArduinoSerial_port_reappeared;
36+
public static String ArduinoSerial_port_still_missing;
37+
public static String ArduinoSerial_reset_dtr_toggle;
38+
public static String ArduinoSerial_reset_failed;
39+
public static String ArduinoSerial_unable_to_open_serial_port;
40+
public static String ArduinoSerial_Using_1200bps_touch;
41+
public static String ArduinoSerial_Using_comport;
42+
public static String Boards_Failed_to_read_boards;
43+
public static String Boards_Get_menu_item_name_from_id_did_not_find;
44+
public static String Boards_menu_ID_not_found;
45+
public static String Boards_menu_name_not_found;
46+
public static String command_aborted;
47+
public static String command_finished;
48+
public static String command_interupted;
49+
public static String command_io;
50+
public static String command_launching;
51+
public static String command_output;
52+
public static String EmptyLibFolder;
53+
public static String Failed_To_Add_Libraries;
54+
public static String failed_to_remove_lib;
55+
public static String Boards_Get_menu_item_id_from_name_failed;
56+
public static String Helpers_Create_folder_failed;
57+
public static String Helpers_delete_folder_failed;
58+
public static String Helpers_error_boards_TXT;
59+
public static String Helpers_Error_File_does_not_exists;
60+
public static String Helpers_error_link_folder_is_empty;
61+
public static String Helpers_Error_parsing_IO_exception;
62+
public static String Helpers_Error_The_folder_is_empty;
63+
public static String Helpers_No_boards_txt_found;
64+
public static String Helpers_tool_reference_missing;
65+
public static String import_lib_failed;
66+
public static String Manager_archive_error_root_folder_name_mismatch;
67+
public static String Manager_archive_error_symbolic_link_to_absolute_path;
68+
public static String Manager_archiver_eror_single_root_folder_required;
69+
public static String Manager_Cant_create_folder;
70+
public static String Manager_Cant_create_folder_exists;
71+
public static String Manager_Cant_extract_file_exist;
72+
public static String Manager_Failed_to_download;
73+
public static String Manager_Failed_to_extract;
74+
public static String Manager_Failed_to_parse;
75+
public static String Manager_Format_not_supported;
76+
public static String MultipleVersionsOfLib;
77+
public static String Platform_loading_boards;
78+
public static String Platform_loading_platform;
79+
public static String security_login;
80+
public static String security_password;
81+
public static String Tool_no_valid_system;
82+
public static String ToolDependency_Tool_not_found;
83+
public static String Upload_console_name;
84+
public static String Upload_error_auth_fail;
85+
public static String Upload_Error_com_port;
86+
public static String Upload_error_connection_refused;
87+
public static String Upload_error_network;
88+
public static String Upload_Error_serial_monitor_restart;
89+
public static String Upload_failed;
90+
public static String Upload_failed_upload_file;
91+
public static String Upload_login_credentials_missing;
92+
public static String Upload_no_arduino_sketch;
93+
public static String Upload_Project_nature_unaccesible;
94+
public static String Upload_sending_sketch;
95+
public static String Upload_sketch_on_yun;
96+
public static String Upload_starting;
97+
public static String Upload_uploading;
98+
public static String uploader_Failed_to_get_upload_recipe;
99+
public static String uploader_no_reset_using_network;
100+
public static String uploader_no_reset_using_programmer;
101+
public static String BoardsManagerIsBussy;
102+
public static String No_Platform_available;
104103
public static String decorator_no_platform;
105104
public static String decorator_no_port;
106105
public static String projectNotFoundInGUI;
106+
public static String sizeReportSketch;
107+
public static String sizeReportData;
107108

108-
static {
109-
// initialize resource bundle
110-
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
111-
}
109+
static {
110+
// initialize resource bundle
111+
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
112+
}
112113

113-
private Messages() {
114-
}
114+
private Messages() {
115+
}
115116
}

io.sloeber.core/src/io/sloeber/core/messages.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,7 @@ No_Platform_available=The default platform (Arduino avr) was not found. Please i
7676
decorator_no_platform=no platform
7777
decorator_no_port=no port
7878
projectNotFoundInGUI=The selected resource does not belong to a project
79+
sizeReportSketch=Sketch uses " arduino_size " bytes (" int(arduino_size/maximum_size*100+0.5) "%) of program storage space. Maximum is " maximum_size " bytes.
80+
sizeReportData=Global variables use "arduino_data" bytes ("int(arduino_data/maximum_data_size*100+0.5)"%) of dynamic memory, leaving "maximum_data_size-arduino_data" bytes for local variables. Maximum is "maximum_data_size" bytes.
81+
82+

io.sloeber.core/src/io/sloeber/core/messages_it.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,7 @@ uploader_no_reset_using_network=Reset non richiesto dato che si sta eseguendo un
7373
uploader_no_reset_using_programmer=Reset non richiesto dato che si sta utilizzando un dispositivo programmatore
7474
decorator_no_platform=nessuna piattaforma
7575
decorator_no_port=nessuna porta
76-
projectNotFoundInGUI=La risorsa selezionata non fa parte di un progetto.
76+
projectNotFoundInGUI=La risorsa selezionata non fa parte di un progetto.
77+
sizeReportSketch=Lo sketch usa " arduino_size " bytes (" int(arduino_size/maximum_size*100+0.5) "%) dello spazio disponibile per i programmi. Il massimo è " maximum_size " byte.
78+
sizeReportData=Le variabili globali usano "arduino_data" byte ("int(arduino_data/maximum_data_size*100+0.5)"%) di memoria dinamica, lasciando altri "maximum_data_size-arduino_data" byte liberi per le variabili locali. Il massimo è "maximum_data_size" byte.
79+

io.sloeber.core/src/io/sloeber/core/messages_nl.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,7 @@ BoardsManagerIsBussy=BoardsManager is nog bezig, probeer later opnieuw.
7575
decorator_no_platform=geen platform
7676
decorator_no_port=geen poort
7777
projectNotFoundInGUI=Het in de GUI geselecteerde item is niet gerelateerd met een project.
78+
sizeReportSketch=De schets gebruikt " arduino_size " bytes (" int(arduino_size/maximum_size*100+0.5) "%) van de programma-opslagruimte. Het maximum is " maximum_size " bytes.
79+
sizeReportData=De globale variabelen gebruiken "arduino_data" bytes ("int(arduino_data/maximum_data_size*100+0.5)"%) van het dynamisch geheugen. Er resteren "maximum_data_size-arduino_data" bytes voor lokale variabelen. Het maximum is "maximum_data_size" bytes.
80+
7881

io.sloeber.core/src/io/sloeber/core/toolchain/ArduinoGnuMakefileGenerator.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
import org.eclipse.core.runtime.Status;
111111
import org.eclipse.core.runtime.SubProgressMonitor;
112112

113+
import io.sloeber.core.Messages;
113114
import io.sloeber.core.common.Common;
114115
import io.sloeber.core.common.Const;
115116

@@ -904,14 +905,21 @@ public MultiStatus regenerateMakefiles() throws CoreException {
904905
IWorkspaceRoot root = CCorePlugin.getWorkspace().getRoot();
905906
IFile sizeAwkFile1 = root.getFile(topBuildDir.append("size.awk"));
906907
File sizeAwkFile = sizeAwkFile1.getLocation().toFile();
907-
String awkContent = new String();
908908
String regex = Common.getBuildEnvironmentVariable(confDesc, "recipe.size.regex", EMPTY);
909-
awkContent = "/" + regex + "/ {arduino_size += $2 }\n";
909+
String awkContent = "BEGIN {maximum_size=ENVIRON[\"upload.maximum_size\"]\n"
910+
+ " maximum_data_size=ENVIRON[\"upload.maximum_data_size\"]}";
911+
awkContent += "/" + regex + "/ {arduino_size += $2 }\n";
910912
regex = Common.getBuildEnvironmentVariable(confDesc, "recipe.size.regex.data", EMPTY);
911913
awkContent += "/" + regex + "/ {arduino_data += $2 }\n";
912914
regex = Common.getBuildEnvironmentVariable(confDesc, "recipe.size.regex.eeprom", EMPTY);
913915
awkContent += "/" + regex + "/ {arduino_eeprom += $2 }\n";
914-
awkContent += "END { print \"size is \" arduino_size \" data is \" arduino_data}";
916+
awkContent += "END { print \"\\n";
917+
awkContent += Messages.sizeReportSketch;
918+
awkContent += "\\n";
919+
awkContent += Messages.sizeReportData;
920+
awkContent += "\\n";
921+
awkContent += "\"}";
922+
915923
try {
916924
FileUtils.write(sizeAwkFile, awkContent, Charset.defaultCharset());
917925
} catch (IOException e) {

0 commit comments

Comments
 (0)