{"id":19848665,"url":"https://github.com/polterguy/babelfish","last_synced_at":"2026-02-13T14:06:47.784Z","repository":{"id":84670020,"uuid":"342465269","full_name":"polterguy/babelfish","owner":"polterguy","description":"Translation service for your own apps","archived":false,"fork":false,"pushed_at":"2022-04-19T06:00:28.000Z","size":96,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-11T12:47:24.919Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ainiro.io/","language":"TSQL","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/polterguy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-02-26T04:44:14.000Z","updated_at":"2023-04-13T17:50:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"7354eae5-be3a-48f0-b202-ef3fa3912729","html_url":"https://github.com/polterguy/babelfish","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polterguy%2Fbabelfish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polterguy%2Fbabelfish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polterguy%2Fbabelfish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polterguy%2Fbabelfish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polterguy","download_url":"https://codeload.github.com/polterguy/babelfish/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241226818,"owners_count":19930487,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-12T13:17:56.127Z","updated_at":"2026-02-13T14:06:42.718Z","avatar_url":"https://github.com/polterguy.png","language":"TSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Babelfish backend\n\nBabelfish is an enterprise translation micro service for apps needing to translate small pieces of text\nto multiple languages. In addition to an administrative backend, it contains two publicly available\nendpoints, intended for being used by for instance frontend applications, needing to translate small\nsnippets of text to multiple languages. The project builds upon these building blocks.\n\n* .Net 5\n* MySQL or Microsoft SQL Server\n* Magic and Hyperlambda\n\n## Structure\n\nThe project contains two main entities that are persisted into the database as tables having the\nsame name.\n\n* `languages` - These are languages the system supports such as Italian, Spanish, English, Norwegian etc.\n* `translations` - These are translated entities in the database, and each translation is associated with one language.\n\nEach translation belongs to one language, and each language can have multiple translations. Languages are referenced\nin the project using the language's ISO 639-1 code. Each translation entity again belongs to one language, and is\nreferenced using the combination of its `id` and `locale` being the ISO code for the language.\n\nThis allows you to retrieve translations from the system for a specific language, and do a key/value substitute\non your client's UI, where each UI component requiring translation somehow is associated with the key the system\nreturns for that particular piece of text.\n\n### Definitions\n\nThe following words have the following meaning in the system.\n\n* `language` - One supported language in the system such as Italian, Spanish, English etc.\n* `translation` - One translated word, phrase, or piece of text, associated with one language, having the translated text as its content in the _\"locale\"_ of the language.\n* `locale` - The ISO 639-1 code for a language.\n* `admin` - One administrative user having access to modify the database of translations.\n* `client` - Client system consuming the translations to display to its end users.\n* `dashboard` - An administrative UI component allowing an admin to edit the database of translations and languages through a UI.\n* `end user` - The end user wanting to see your application in his language of choice.\n* `namespace` - A unique string defining a single client somehow, allowing you to filter translations such that only translations relevant to one particular client is returned by the system.\n\n## Publicly available endpoints\n\nThese endpoints requires no authentication and are intended to be invoked by clients\nneeding to translate buttons, checkboxes, etc, for the end user to see these in his language of\nchoice.\n\n* __GET__ - `magic/modules/babelfish/public/get-languages` - Returns all supported languages.\n* __GET__ - `magic/modules/babelfish/public/get-translations` - Returns all translated entities.\n\nTypically you would invoke the _\"get-languages\"_ endpoint to retrieve all supported languages, for\nthen to allow the end user to select a language from for instance a select list populated\nby the result of this invocation.\n\nAs the user selects a language, you would retrieve translations by invoking the _\"get-translations\"_\nendpoint, passing in the language the user selected. The last invocation requires a **[locale.eq]**\nargument, to filter results according to one language, and is one of the returned `locale` values from\nthe _\"get-languages\"_ endpoint.\n\nBoth of these endpoints are caching their result for 20 minutes by applying the `Cache-Control` HTTP\nheader before returning the result to the caller.\n\nTypically you would store the selected language in the client, as the end user selects a language -\nAnd as the client initialises the next time, automatically retrieve all translation entities according\nto the end user's selection. Probably defaulting to for instance English if the end user has still not\nexplicitly selected a language.\n\n## Administrative endpoints\n\nIn addition to the above publicly available endpoints, the module exposes 10 administrative endpoints,\nhelping you to administer the system's database of languages and translations. These are as follows.\n\n* __GET__ - `magic/modules/babelfish/admin/languages` - Returns all supported languages.\n* __GET__ - `magic/modules/babelfish/admin/languages-count` - Returns the number of languages that exists in its database.\n* __POST__ - `magic/modules/babelfish/admin/languages` - Creates a new language.\n* __PUT__ - `magic/modules/babelfish/admin/languages` - Updates an existing language.\n* __DELETE__ - `magic/modules/babelfish/admin/languages` - Deletes a specific language. Notice, if the language contains translations this wil fail due to referential integrity on the database level. Delete all translations belonging to the language _first_ if you really need to do this.\n* __GET__ - `magic/modules/babelfish/admin/translations` - Returns translations according to the specified arguments.\n* __GET__ - `magic/modules/babelfish/admin/translations-count` - Returns the number of translations in the system acccording to the specified arguments.\n* __POST__ - `magic/modules/babelfish/admin/translations` - Creates a new translation entity given the specified arguments. Notice, this endpoint allows you to automatically translate the specified translation entity by invoking Google Translate for each supported language on the server.\n* __PUT__ - `magic/modules/babelfish/admin/translations` - Updates an existing translation entity.\n* __DELETE__ - `magic/modules/babelfish/admin/translations` - Deletes one specific translation according to the specified arguments.\n\nIn addition to the above CRUD endpoints allowing you to administer your database, the system also contains the following\nstatistical endpoint, returning information about the state of your database.\n\n* __GET__ - `magic/modules/babelfish/admin/statistics` - Returns statistics about missing translation entities for languages, making it easier to see which languages are incomplete somehow, and are missing translation items in your database for specific languages.\n\nAll of the above admin endpoints requires the user to belong to one of the following roles to allow the user to invoke the endpoint.\n\n* root\n* admin\n* translator\n\n## Namespacing translation entities\n\nThe system supports namespaces, allowing you to filter your invocations to the above\n_\"get-translations\"_ endpoint, such that only translations relevant to your client\nis returned. This needs to be accommodated for as you create your translation entities, by\nusing an `id` for your translations _\"namespacing\"_ the client it is intended to consumed from.\n\nFor instance, if you have an application called _\"Acme Chat\"_, and this application contains a _\"send\"_\nbutton you want to translate to multiple languages, the id of your translation items for this button\ncould be for instance something like _\"acme.chat.buttons.send\"_.\n\nThen as you retrieve items for your _\"acme.chat\"_ client, you would pass in a query parameter named\n`locale.eq` and set its value to `acme.chat%`. The percent sign here becomes a wildcard, returning\nall items starting with the namespace of `acme.chat`.\n\n## Google translate\n\nWhen an admin user wants to create translation entities, the system allows him to automatically translate whatever\nhe supplies to the system, to all other supported languages automatically by using Google Translate. This allows the\nadmin user to supply one translation entity to the system, and having a _\"sane default\"_ value provided for all other\nlanguages in the database.\n\nOf course, this is _not perfect_, and sometimes Google Translate does a very bad job at translating such phrases\nand words - But at least it provides you with a starting ground, significantly simplifying the job of translating\nyour app, even to languages you do not master.\n\n**Notice** - The system does _not_ translate existing entities when you create new _languages_, only as you create\nnew _translation entities_. Hence, if you already have created translation entities, and then later add languages\nto your database, you will have to manually go through each translation entity and translate the entity explicitly.\n\n## Dashboard\n\nThe system comes with a [dashboard admin UI](https://github.com/polterguy/babelfish.frontend) that you can use\nin your organisation to allow for translators to easily administrate your translation database.\n\n## License\n\nBasically, you can install the Software on an infinite amount of development machines, and _one_\nproduction machine. See the enclosed file _\"LICENSE\"_ for details which is being distributed together with\nthe software.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolterguy%2Fbabelfish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolterguy%2Fbabelfish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolterguy%2Fbabelfish/lists"}