Skip to content

Commit e60ccd1

Browse files
committed
print warning when no locale is configured
1 parent e0653d8 commit e60ccd1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/locales.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <stdlib.h>
1010
#include <flutter-pi.h>
1111

12-
#define LOG_LOCALES_MESSAGE(fmtstring, ...) fprintf(stderr, "[locales] " fmtstring, __VA_ARGS__);
12+
#define LOG_LOCALES_ERROR(fmtstring, ...) fprintf(stderr, "[locales] " fmtstring # __VA_ARGS__);
1313

1414
struct locale {
1515
char *language;
@@ -311,6 +311,10 @@ struct locales *locales_new(void) {
311311
i++;
312312
}
313313

314+
if (strcmp(fl_locales[0]->language_code, "C") == 0) {
315+
LOG_LOCALES_ERROR("Warning: The system has no configured locale. The default \"C\" locale may or may not be supported by the app.\n");
316+
}
317+
314318
locales->flutter_locales = fl_locales;
315319
locales->n_locales = n_locales;
316320
locales->default_locale = NULL;
@@ -387,7 +391,7 @@ int locales_add_to_fl_engine(struct locales *locales, FlutterEngine engine, Flut
387391

388392
engine_result = update_locales(engine, locales->flutter_locales, locales->n_locales);
389393
if (engine_result != kSuccess) {
390-
LOG_LOCALES_MESSAGE("Couldn't update flutter engine locales. FlutterEngineUpdateLocales: %s\n", FLUTTER_RESULT_TO_STRING(engine_result));
394+
LOG_LOCALES_ERROR("Couldn't update flutter engine locales. FlutterEngineUpdateLocales: %s\n", FLUTTER_RESULT_TO_STRING(engine_result));
391395
return EINVAL;
392396
}
393397

0 commit comments

Comments
 (0)