{"id":20644278,"url":"https://github.com/senselogic/lingui","last_synced_at":"2026-04-26T20:31:30.040Z","repository":{"id":114210112,"uuid":"136363014","full_name":"SenseLogic/LINGUI","owner":"SenseLogic","description":"Internationalization code generator for C#, D and Dart applications.","archived":false,"fork":false,"pushed_at":"2021-08-29T16:23:17.000Z","size":455,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-05T16:05:47.394Z","etag":null,"topics":["code-generator","csharp","dartlang","dlang","internationalization","localization"],"latest_commit_sha":null,"homepage":"","language":"D","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SenseLogic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-06T17:28:54.000Z","updated_at":"2024-08-29T03:57:17.000Z","dependencies_parsed_at":"2023-05-30T13:30:20.720Z","dependency_job_id":null,"html_url":"https://github.com/SenseLogic/LINGUI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SenseLogic/LINGUI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SenseLogic%2FLINGUI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SenseLogic%2FLINGUI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SenseLogic%2FLINGUI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SenseLogic%2FLINGUI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SenseLogic","download_url":"https://codeload.github.com/SenseLogic/LINGUI/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SenseLogic%2FLINGUI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32312195,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T19:15:34.056Z","status":"ssl_error","status_checked_at":"2026-04-26T19:15:15.467Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-generator","csharp","dartlang","dlang","internationalization","localization"],"created_at":"2024-11-16T16:15:37.255Z","updated_at":"2026-04-26T20:31:30.033Z","avatar_url":"https://github.com/SenseLogic.png","language":"D","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://github.com/senselogic/LINGUI/blob/master/LOGO/lingui.png)\n\n# Lingui\n\nInternationalization code generator for C#, D and Dart applications.\n\n## Description\n\nLingui converts translator-friendly scripts into C#, D and Dart code which can be directly integrated into the localized application.\n\nIts minimalistic and concise syntax is designed to allow professional translators to provide their static and dynamic translations through simple scripts.\n\n## Sample\n\n### Lingui\n\n```lua\nLANGUAGE\n\n    GameOver\n\n    Welcome first_name last_name\n\n    Pears #count\n\nENGLISH_LANGUAGE : LANGUAGE\n\n    \"princess\"\n        1*\"princess\":female\n\n    \"NewGame\"\n        \"New game\"\n\n    GameOver\n        \"Game over!\"\n\n    Welcome first_name last_name\n        \"Welcome, \" ~ first_name ~ \" \" ~ last_name ~ \"!\"\n\n    Pears #count\n        $count ~ \" \"\n        if count = 1\n            \"pear\"\n        else\n            \"pears\"\n\nGERMAN_LANGUAGE : LANGUAGE\n\n    \"princess\"\n        1*\"Prinzessin\":female\n\n    \"NewGame\"\n        \"Neues Spiel\"\n\n    GameOver\n        \"Spiel vorbei!\"\n\n    Welcome first_name last_name\n        \"Willkommen, \" ~ first_name ~ \" \" ~ last_name ~ \"!\"\n\n    Pears #count\n        $count ~ \" \"\n        if count = 1\n            \"Birne\"\n        else\n            \"Birnen\"\n\nFRENCH_LANGUAGE : LANGUAGE\n\n    \"princess\"\n        1*\"princesse\":female\n\n    \"NewGame\"\n        \"Nouveau jeu\"\n\n    GameOver\n        \"Fin du jeu !\"\n\n    Welcome first_name last_name\n        \"Bienvenue, \" ~ first_name ~ \" \" ~ last_name ~ \" !\"\n\n    Pears #count\n        $count ~ \" \"\n        if count = 0 or count = 1\n            \"poire\"\n        else\n            \"poires\"\n```\n\n### C\u0026#35;\n\n```cs\n// -- IMPORTS\n\nusing System;\nusing LINGUI;\n\n// -- TYPES\n\npublic class TEST\n{\n    // -- OPERATIONS\n\n    public static void TestLanguage(\n        LANGUAGE language\n        )\n    {\n        Console.WriteLine( language.GetText( \"princess\" ) );\n        Console.WriteLine( language.GetText( \"NewGame\" ) );\n        Console.WriteLine( language.GameOver() );\n        Console.WriteLine( language.Welcome( \"Jack\", \"Sparrow\" ) );\n        Console.WriteLine( language.Pears( 0 ) );\n        Console.WriteLine( language.Pears( 1 ) );\n        Console.WriteLine( language.Pears( 2 ) );\n    }\n\n    // ~~\n\n    public static void Main(\n        string[] argument_array\n        )\n    {\n        TestLanguage( new ENGLISH_LANGUAGE() );\n        TestLanguage( new GERMAN_LANGUAGE() );\n        TestLanguage( new FRENCH_LANGUAGE() );\n    }\n}\n```\n\n### D\n\n```d\n// -- IMPORTS\n\nimport lingui.english_language;\nimport lingui.french_language;\nimport lingui.german_language;\nimport lingui.language;\nimport lingui.translation;\nimport std.stdio : writeln;\n\n// -- FUNCTIONS\n\nvoid TestLanguage(\n    LANGUAGE language\n    )\n{\n    writeln( language.GetText( \"princess\" ) );\n    writeln( language.GetText( \"NewGame\" ) );\n    writeln( language.GameOver() );\n    writeln( language.Welcome( \"Jack\", \"Sparrow\" ) );\n    writeln( language.Pears( 0 ) );\n    writeln( language.Pears( 1 ) );\n    writeln( language.Pears( 2 ) );\n}\n\n// ~~\n\nvoid main(\n    string[] argument_array\n    )\n{\n    TestLanguage( new ENGLISH_LANGUAGE() );\n    TestLanguage( new GERMAN_LANGUAGE() );\n    TestLanguage( new FRENCH_LANGUAGE() );\n}\n```\n\n### Dart\n\n```dart\n// -- IMPORTS\n\nimport \"english_language.dart\";\nimport \"french_language.dart\";\nimport \"german_language.dart\";\nimport \"language.dart\";\nimport \"translation.dart\";\n\n// -- FUNCTIONS\n\nvoid TestLanguage(\n    LANGUAGE language\n    )\n{\n    print( language.GetText( \"princess\" ) );\n    print( language.GetText( \"NewGame\" ) );\n    print( language.GameOver() );\n    print( language.Welcome( \"Jack\", \"Sparrow\" ) );\n    print( language.Pears( 0 ) );\n    print( language.Pears( 1 ) );\n    print( language.Pears( 2 ) );\n}\n\n// ~~\n\nvoid main(\n    List\u003cString\u003e argument_list\n    )\n{\n    TestLanguage( ENGLISH_LANGUAGE() );\n    TestLanguage( GERMAN_LANGUAGE() );\n    TestLanguage( FRENCH_LANGUAGE() );\n}\n```\n\n### Result\n\n```\nprincess\nNew game\nGame over!\nWelcome, Jack Sparrow!\n0 pears\n1 pear\n2 pears\nPrinzessin\nNeues Spiel\nSpiel vorbei!\nWillkommen, Jack Sparrow!\n0 Birnen\n1 Birne\n2 Birnen\nprincesse\nNouveau jeu\nFin du jeu !\nBienvenue, Jack Sparrow !\n0 poire\n1 poire\n2 poires\n```\n\n## Syntax\n\n### Indentation\n\nLingui scripts are indentation-based.\n\nThe first level contains the language class names, and the second level contains the translation constants and functions.\n\n### Language classes\n\nA language class can extend another one, by specifying the base language after a colon (`:`).\n\nA base language must be declared before its derived languages.\n\nThe first language (often named `LANGUAGE`) is generally used to declare all the translation functions that the localized application code will use.\n\nThe next languages then extend it, in order to provide their language-specific implementations.\n\n### Translation functions\n\nFunctions can have parameters and declare local variables.\n\nThe type of the functions, function parameters and local variables is defined through their declaration prefix :\n\n*   none : string\n*   `!` : boolean\n*   `#` : integer\n*   `%` : real\n*   `:` : translation\n*   `@` : native\n\nNative imports, attributes and methods are written in the target programming language, using indentations for blocks.\n\n```lua\n@import \"dart:core\";\n\n@String Separator;\n\n@String GetDate( int day, int month, int year )\n    if ( Separator == \"\" )\n        Separator = \"-\";\n    return \"${day}${Separator}${month}${Separator}${year}\";\n\n@String GetDate( DateTime date )\n    return GetCustomDate( date.day, date.month, date.year );\n```\n\n### Translation value\n\nA translation value is a data structure which provides one or several of the following properties :\n\n*   a text (`$`);\n*   a quantity text (`*`), with an integer (`#`) or real (`%`) value;\n*   a genre (`\u0026`).\n\n### Translation constants\n\nA translation constant is a quoted string.\n\nIt is only declared in actual language classes.\n\nIts definition is made of a list of expressions which are evaluated and concatenated only once.\n\nThe result of this concatenation is stored inside the translation dictionary of its language.\n\n### Quoted strings\n\nA quoted string is enclosed in double quote characters.\n\nThe new line character is `§`.\n\nPrefixing a character with `\\` escapes it.\n\n### Function statements\n\n*   Textual expressions\n\n    ```lua\n    \"Some text...§\"\n    GetTitleCase( Swords( 2* ) )\n    ```\n\n*   Conditions\n\n    ```lua\n    if @person = one\n        if \u0026person = female\n            ...\n        else if \u0026person = male\n            ...\n        else\n            ...\n    else if #person \u003c= 3\n        ...\n    else\n        ...\n    ```\n\n*   Returns\n\n    ```lua\n    return count + 1\n    ```\n\n*   Variable declarations and assignments\n\n    ```lua\n    var :kings :queens :princes\n    kings = Kings( 1* )\n    $queens = \"reinas\"\n    *queens = \"2\"\n    \u0026queens = female\n    princes = 3*\"príncipes\":male\n    ```\n\n### Result variable\n\nA `result` translation variable is implicitly declared to\naccumulate the textual expressions of each translation function which :\n\n*   actually uses textual expressions;\n*   doesn't explicitly declare a `result` variable;\n*   doesn't use any `return` statement;\n*   hasn't a single-line definition starting with a quoted string (`\"`).\n\n### Variable accessors\n\nBoolean, integer and real variable names can be prefixed by the following accessor :\n\n```lua\n$    text\n```\n\nTranslation variable names can be prefixed by the following accessors :\n\n```lua\n$    text\n*    quantity text\n^    quantity first character\n#    quantity integer value\n%    quantity real value\n!    quantity is integer\n.    quantity is real\n@    cardinal plurality (zero, one, two, few, many, other)\n°    ordinal plurality (zero, one, two, few, many, other)\n\u0026    genre (neutral, male, female)\n```\n\n### Operators\n\n```lua\n~      text concatenation\n+      addition\n-      substraction\n*      multiplication\n/      division\n%      division remainder\nnot    logical not\nand    logical and\nor     logical or\n\u003c      lower\n\u003e      higher\n\u003c=     lower equal\n\u003e=     higher equal\n=      equal\n\u003c\u003e     not equal\n( )    grouping parentheses\n```\n\n### Literals\n\n```lua\n\"Some text.§\"          text\n'.'                     character\n1                       integer\n2.5                     real\n3*                      integer quantity\n4*\"perros\"              integer quantity and text\n5*\"fiestas\":female      integer quantity, text and genre\n6.5*                    real quantity\n7.5*\"metros\"            real quantity and text\n8.5*\"vueltas\":female    real quantity, text and genre\n```\n\n### Predefined constants\n\n```lua\nfalse\ntrue\n\nzero\none\ntwo\nfew\nmany\nother\n\nneutral\nmale\nfemale\n```\n\n### Predefined functions\n\n```lua\nMakeTranslation( text, quantity, genre )\nMakeTranslation( text, quantity )\nMakeTranslation( text, genre )\nMakeTranslation( text )\nMakeTranslation( integer_quantity, genre )\nMakeTranslation( integer_quantity )\nHasTranslation( key )\nGetTranslation( key )\nGetText( key )\nGetLowerCase( text )\nGetLowerCase( translation )\nGetUpperCase( text )\nGetUpperCase( translation )\nGetTitleCase( text )\nGetTitleCase( translation )\nGetSentenceCase( text )\nGetSentenceCase( translation )\nHasFirstCharacter( text, first_characters )\nHasFirstCharacter( translation, first_characters )\nHasPrefix( text, prefix )\nHasPrefix( translation, prefix )\nHasSuffix( text, suffix )\nHasSuffix( translation, suffix )\nGetIntegerReal( integer )\nGetRealInteger( real )\nGetTextBoolean( text )\nGetTextInteger( text )\nGetTextReal( text )\nGetBooleanText( boolean )\nGetIntegerText( integer, minimum_digit_count )\nGetIntegerText( integer )\nGetRealText( real, minimum_fractional_digit_count, maximum_fractional_digit_count, dot_character )\nGetRealText( real, minimum_fractional_digit_count, maximum_fractional_digit_count )\nGetRealText( real, minimum_fractional_digit_count )\nGetRealText( real )\nGetGenreText( genre )\nGetPluralityText( plurality )\nGetCardinalPlurality( translation )\nGetOrdinalPlurality( translation )\n```\n\n### Comments\n\n```\n// This is a comment.\n```\n\n### Definition extraction\n\nWhen the `--extract` option is used, all constants definitions declared before the first function of each `.lg` file\nare extracted into matching `.ld` definition files.\n\nMatching definitions must have the same line number.\n\nAn empty line is considered as a missing entry.\n\nDefinitions which include the newline character (`§`) are split over several lines, using a four space indentation.\n\n```lua\n\"Spanish language\"\n\"Limits are created by mind.\"\n    \"Imagination can take you to the heavens.\"\n    \"Now imagine something.\"\n```\n\nThe definition file syntax is compatible with the following online translators :\n\n*   [Bing](https://www.bing.com/translator)\n*   [Collins](https://www.collinsdictionary.com/translator)\n*   [DayTranslations](https://www.daytranslations.com/freetranslation)\n*   [DeepL](https://www.deepl.com/translator)\n*   [Google](https://translate.google.com)\n*   [Promt](https://www.online-translator.com)\n*   [Reverso](http://www.reverso.net/text_translation.aspx)\n*   [Systran](http://www.systranet.com/translate)\n*   [WorldLingo](http://www.worldlingo.com/products_services/worldlingo_translator.html)\n*   [Yandex](https://translate.yandex.com)\n\n### Constant mirroring\n\nWhen the `--mirror` option is used :\n\n*   all constants declared before the first function are sorted in the target language using the same order as in the source language;\n*   missing constants are automatically added, using the definitions provided by the matching `.ld` files.\n\n### Definition picking\n\nWhen the `--pick` option is used, the constants definitions stored in the `.lt` translation files are matched\nby line number.\n\nDefinitions are provided in named groups.\n\nA source group name starts with `\u003c`, while a target group name starts with `\u003e`.\n\nThe most used target definitions are picked.\n\nIf several definitions have the same highest frequency, the first one is picked.\n\n```lua\n\u003c English\n\n\"Spanish language\"\n\"Limits are created by mind.\"\n    \"Imagination can take you to the heavens.\"\n    \"Now imagine something.\"\n\n\u003c French\n\n\"Langue espagnole\"\n\"Les limites sont créées par l'esprit.\"\n    \"L'imagination peut vous emmener au ciel.\"\n    \"Maintenant imaginez quelque chose.\"\n\n\u003e Collins/English\n\n\"スペイン語\"\n\"限界は心によって作成される。\"\n    \"想像力は天に連れて行くことができます。\"\n    \"今は何かを想像する\"\n\n\u003e Collins/French\n\n\"スペイン語\"\n\"限界は精神によって作成される。\"\n    \"想像力は天国に連れて行くことができます。\"\n    \"今は何かを想像する\"\n\n\u003e Yandex/English\n\n\"スペイン語\"\n\"制限は心によって作成されます。\"\n    \"想像力は天に連れて行くことができます。\"\n    \"今何かを想像してみてください。\"\n\n\u003e Yandex/French\n\n\"スペイン語\"\n\"境界は心によって作成されます。\"\n    \"想像力は天国にあなたを取ることができます。\"\n    \"今何かを想像してください。\"\n\n\u003e Reverso/English\n\n\"スペインの言語\"\n\"限度が心によって作られます。\"\n    \"想像力があなたを天に導くことができます。\"\n    \"今何かを想像してください。\"\n\n\u003e Reverso/French\n\n\"スペインの言語\"\n\"限界は精神によって作られます。\"\n    \"想像力はあなたを空に導くことができます。\"\n    \"今何かを想像してください。\"\n```\n\n### Case conventions\n\n*   Class names : `UPPER_CASE`;\n*   Function names : `PascalCase`;\n*   Parameter and variable names : `snake_case`.\n\n### Limitations\n\nOperators and variables must be separated by spaces.\n\n### Installation\n\nInstall the [DMD 2 compiler](https://dlang.org/download.html) (using the MinGW setup option on Windows).\n\nThen build the executable with the following command line :\n\n```bash\ndmd -m64 lingui.d\n```\n\n### Command line\n\n```bash\nlingui [options] language.lg language.lg first_language.lg second_language.lg ... OUTPUT_FOLDER/\n```\n\n### Options\n\n```\n--cs : generate C# files\n--d : generate D files\n--dart : generate Dart files\n--base : generate the base classes\n--float : use single precision numbers\n--namespace LINGUI : use this namespace\n--uppercase : generate uppercase filenames\n--check : check for missing constants or functions\n--preview : preview the changes without applying them\n--find CODE_FOLDER/ : find the constants used by the code inside this folder\n--mirror SOURCE_LANGUAGE : mirror the translation constants of this language\n--extract : extract the language definitions\n--pick : pick the best translations\n```\n\nThe `--cs`, `--d` and `--dart` options are mutually exclusive.\n\n### Examples\n\n```bash\nlingui --dart --check --base --namespace game language.lg english_language.lg german_language.lg DART/\n```\n\nConverts Lingui files to Dart source code files, generating the base classes too, using \"game\" as namespace, and\nchecking for missing constants or functions.\n\n```bash\nlingui --cs --float language.lg english_language.lg german_language.lg CS/\n```\n\nConverts Lingui files to C# source code files, using single precision numbers.\n\n```bash\nlingui --find CODE_FOLDER/ language.lg english_language.lg french_language.lg spanish_language.lg\n```\n\nFind the constants used by the code inside \"CODE_FOLDER/\".\n\n```bash\nlingui --mirror ENGLISH_LANGUAGE --preview language.lg english_language.lg french_language.lg spanish_language.lg\n```\n\nMirrors the translation constants of `english_language.lg` into `french_language.lg` and `spanish_language.lg`.\n\n```bash\nlingui --extract --preview language.lg english_language.lg french_language.lg spanish_language.lg\n```\n\nExtract the constant definitions from these `.lg` files into their matching `.ld` files.\n\n```bash\nlingui --pick japanese_language.lg\n```\n\nPick the best translations for this `.lg` file using its matching `.lt` file.\n\n## Limitations\n\n*   The cardinal and ordinaly pluralities are provided only for the following languages :\n    *   English\n    *   Japanese\n    *   Korean\n    *   Chinese\n    *   German\n    *   French\n    *   Italian\n    *   Spanish\n    *   Portuguese\n    *   Russian\n    *   Turquish\n    *   Dutch\n    *   Swedish\n    *   Norwegian\n    *   Danish\n    *   Arabic\n\n## Version\n\n3.1\n\n## Author\n\nEric Pelzer (ecstatic.coder@gmail.com).\n\n## License\n\nThis project is licensed under the GNU Lesser General Public License version 3.\n\nSee the [LICENSE.md](LICENSE.md) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsenselogic%2Flingui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsenselogic%2Flingui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsenselogic%2Flingui/lists"}