Skip to content

Internationalisation(I18N) for C -> I19C ๐ŸŒŽ

Notifications You must be signed in to change notification settings

RahulNavneeth/i19c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

i19c โ€” Internationalization C

Installation

Clone or add i19c as a submodule:

git submodule add https://github.com/RahulNavneeth/i19c lib/i19c

Usage

Step 1: Add to your build

If you're using make, add the following:

CFLAGS += -Ilib/i19c/include -Ilib/i19c/.i19c
LDFLAGS += -Llib/i19c/bin -li19c

Then build i19c:

cd lib/i19c && make all path=../../<path-to-your-i19c-folder>

Adjust the path as needed based on your project layout.


Step 2: Create your language files

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.

Step 3: Use in your code

#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.


Example

Video demo:

i19c-example-demo-with-clay.mov

Example project: https://github.com/RahulNavneeth/i19c-example


About

Internationalisation(I18N) for C -> I19C ๐ŸŒŽ

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published