Clone or add i19c as a submodule:
git submodule add https://github.com/RahulNavneeth/i19c lib/i19cIf you're using make, add the following:
CFLAGS += -Ilib/i19c/include -Ilib/i19c/.i19c
LDFLAGS += -Llib/i19c/bin -li19cThen build i19c:
cd lib/i19c && make all path=../../<path-to-your-i19c-folder>Adjust the path as needed based on your project layout.
In your internationalization folder, add a file like english.h:
#ifndef ENGLISH_H
#define ENGLISH_H
#define GREETING "Welcome @! Good to have you here."
#endif- The file name (without
.h) is the language key used in code. - Use
@in strings to denote dynamic variables.
#include "i19c.h"
int main() {
I19C *lang_ctx = get_i19c();
set_lang_i19c(lang_ctx, "english");
T(lang_ctx, "GREETING", "Rahul");
}This will print: Welcome Rahul! Good to have you here.
Video demo:
i19c-example-demo-with-clay.mov
Example project: https://github.com/RahulNavneeth/i19c-example