mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-06-16 17:48:29 +02:00
ea4302b41e
This commit adds a new string formatting system to replace uses of `SDL_snprintf` and string concatenation. Making our own string formatting system has been briefly discussed during the review of the localization branch, and on the VVVVVV Discord. It's inspired by Python's format strings, but simpler. This is primarily to benefit localization - strings will be easier to understand (`Now using %s Tileset` → `Now using {area} Tileset`, `"%s remain"` → `"{n_crewmates|wordy} remain"`), translators can change the word order for their language's grammar (`%1$s` is a POSIX extension), and this system is also less error-prone (making the format string not align with the actual arguments won't result in a crash or UB). It also integrates our needs better - particularly the "wordy" numbers without having to have a `help.number_words(n).c_str()` at the callsite, translators can opt in and out of wordy numbers per string, and this should also make it easier to solve #859. This commit adds the formatting system itself, and changes one `SDL_snprintf` in the code to use it as a small demo (the rest should probably be done in the localization branch to avoid more unneeded work). The system is described in full detail in VFormat.h and in the pull request description.
7 lines
100 B
C
7 lines
100 B
C
#ifndef CWRAPPERS_H
|
|
#define CWRAPPERS_H
|
|
|
|
char* HELP_number_words(int _t);
|
|
|
|
#endif /* CWRAPPERS_H */
|