Skip to content

Commit 326fe4f

Browse files
committed
Namespace refactoring
1 parent 5c3fc40 commit 326fe4f

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

examples/i18n/i18n.ino

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include <LittleFS.h>
22
#include <YAMLDuino.h>
33

4-
54
#include <vector>
65
static std::vector<String> i18nFiles;
6+
77
const char* extension = "yml";
88
const char* path = "/lang";
99

@@ -14,14 +14,14 @@ void setup()
1414
Serial.begin(115200);
1515
LittleFS.begin();
1616

17-
Serial.printf( "[%d] %s\n", ESP.getFreeHeap(), "Hello i18n test");
17+
Serial.println( "Hello i18n test");
1818

1919
// scan the lang folder and store filenames in an array
2020

2121
File dir = LittleFS.open( path );
2222

2323
if( !dir ) {
24-
Serial.printf("Error, can't access filesystem, halting");
24+
Serial.println("Error, can't access filesystem, halting");
2525
while(1) vTaskDelay(1);
2626
}
2727

@@ -47,21 +47,21 @@ void loop()
4747
{
4848
int randLang = rand()%(i18nFiles.size());
4949

50-
int free_heap_before_load = ESP.getFreeHeap();
50+
int free_heap_before_load = HEAP_AVAILABLE();
5151

5252
if(! i18n.setLocale(i18nFiles[randLang].c_str()) ) {
5353

54-
Serial.printf( "[%d] Error loading locale %s, halting\n", ESP.getFreeHeap(), i18nFiles[randLang].c_str());
54+
YAML_LOG_n( "Error loading locale %s, halting\n", i18nFiles[randLang].c_str());
5555

5656
while(1) vTaskDelay(1);
5757
}
5858

59-
int free_heap_after_load = ESP.getFreeHeap();
59+
int free_heap_after_load = HEAP_AVAILABLE();
6060

61-
Serial.printf( "[%d-%d] Locale file %s loaded\n", free_heap_before_load, free_heap_after_load, i18nFiles[randLang].c_str());
61+
YAML_LOG_n( "[%d-%d] Locale file %s loaded\n", free_heap_before_load, free_heap_after_load, i18nFiles[randLang].c_str());
6262

63-
Serial.printf( "[%d] %s\n", ESP.getFreeHeap(), i18n.gettext("activerecord:errors:messages:record_invalid" ) ); // "La validation a échoué : %{errors}"
64-
Serial.printf( "[%d] %s\n", ESP.getFreeHeap(), i18n.gettext("date:abbr_day_names:2" ) ); // "mar"
65-
Serial.printf( "[%d] %s\n", ESP.getFreeHeap(), i18n.gettext("time:pm" ) ); // "pm", last element
63+
Serial.println( i18n.gettext("activerecord:errors:messages:record_invalid" ) ); // "La validation a échoué : %{errors}"
64+
Serial.println( i18n.gettext("date:abbr_day_names:2" ) ); // "mar"
65+
Serial.println( i18n.gettext("time:pm" ) ); // "pm", last element
6666
delay( 1000 );
6767
}

src/ArduinoYaml.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ extern "C"
5757

5858
#define I18N_SUPPORT
5959

60-
#if !defined WIO_TERMINAL && __has_include(<FS.h>)
60+
#if __has_include(<FS.h>)
6161
#define I18N_SUPPORT_FS
6262
#endif
6363

0 commit comments

Comments
 (0)