{"id":25171707,"url":"https://github.com/basemax/cpp-mylanguage","last_synced_at":"2025-05-05T21:09:55.235Z","repository":{"id":132737999,"uuid":"347129701","full_name":"BaseMax/CPP-MyLanguage","owner":"BaseMax","description":"My Language C++ TINY Library: A c++ library to handle and manage all of words/strings and languages of a software in a JSON structure.","archived":false,"fork":false,"pushed_at":"2022-01-14T15:24:56.000Z","size":1172,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-04T21:45:35.960Z","etag":null,"topics":["cpp","cpp-17","json","language-manager","languages","translate","translater","translates"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BaseMax.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,"zenodo":null}},"created_at":"2021-03-12T16:31:41.000Z","updated_at":"2022-07-25T15:10:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"7de9c306-4fe7-468e-9a92-ab08d81e7671","html_url":"https://github.com/BaseMax/CPP-MyLanguage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FCPP-MyLanguage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FCPP-MyLanguage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FCPP-MyLanguage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FCPP-MyLanguage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaseMax","download_url":"https://codeload.github.com/BaseMax/CPP-MyLanguage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252577020,"owners_count":21770721,"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":["cpp","cpp-17","json","language-manager","languages","translate","translater","translates"],"created_at":"2025-02-09T09:21:41.084Z","updated_at":"2025-05-05T21:09:55.229Z","avatar_url":"https://github.com/BaseMax.png","language":"C++","readme":"# C++ MyLanguage\n\nMy Language Cpp TINY Library\n\n\u003e A c++ library to handle and manage all of words/strings and languages of a software in a JSON structure.\n\nIf your software is a bit international and you want to handle and manage all of strings and languages from server.\n\n**JSON** is a good format and you can easily seperate words and strings into diffrent parts. But main problem is how to parse a complex **JSON** structure in c++ and use this.\n\nWe need to parse JSON and access to each element and value of JSON at the runtime.\nIn this library I did implenment some useful function to easily parse and use JSON structure and store in a `std::map`, So you can easily access to strings anywhere.\n\nYou can check the [input.json](input.json) file to better understand how the library works.\n\n## Purpose of library \n\nDid you translate words to different languages? Do your software support multi language and you want to handle languages without suffering.\n\nSo you can try or improve this library for your use.\n\n## How To Build\n\nThanks to CMake, it's simple:\n\n```\n$ mkdir build;\n$ cd build;\n$ cmake ..; make -j`nproc`\n```\n\nAfter a successful build, you have:\n1. The static build: `output/lib`\n2. The shared build: `output/lib`\n3. The binary build: `output/bin`\n4. The header files: `output/lib/include`  \n\nLet me know if it's not enough for you.\n\n## Example\n\n```cpp\n#include \"my_language.hpp\"\n\nLanguage lang;\nlang.setFile(\"input.json\");\nlang.parse();\n\nlang.log();\n\nstd::cout \u003c\u003c \"------------------------------ [ TEST getString ] -----------------------------\\n\";\n\nstd::cout \u003c\u003c lang.getString(\"exceptions\", \"fa_IR\", \"error\")-\u003edefault_value() \u003c\u003c \"\\n\";\n\nstd::cout \u003c\u003c lang.getString(\"exceptions\", \"en_US\", \"error\")-\u003edefault_value() \u003c\u003c \"\\n\";\n\n\n\nstd::cout \u003c\u003c \"------------------------------ [ TEST getString has_error ] -----------------------------\\n\";\n\nauto i = lang.getString(\"exceptions\", \"en_US\", \"_bad_keyword_bad_\");\nstd::cout \u003c\u003c \"...\\n\";\nif(i-\u003ehas_error()) {\n    std::cout \u003c\u003c \"A error...\\n\";\n}\nelse {\n    std::cout \u003c\u003c i-\u003ehas_error() \u003c\u003c \"\\n\";\n}\n\n\nstd::cout \u003c\u003c \"------------------------------ [ TEST hasString ] -----------------------------\\n\";\n\nbool j = lang.hasString(\"exceptions\", \"en_US\", \"_bad_keyword_bad_\");\nif(j == true) {\n    std::cout \u003c\u003c \"No error!\\n\";\n}\nelse {\n    std::cout \u003c\u003c \"A error...\\n\";\n}\n\nj = lang.hasString(\"exceptions\", \"en_US\", \"error\");\nif(j == true) {\n    std::cout \u003c\u003c \"No error!\\n\";\n}\nelse {\n    std::cout \u003c\u003c \"A error...\\n\";\n}\n\n\nstd::cout \u003c\u003c \"------------------------------ [ TEST getString in another sheet ] -----------------------------\\n\";\n\nauto k = lang.getString(\"global\", \"fa_IR\", \"name\");\nif(k-\u003ehas_error()) {\n    std::cout \u003c\u003c \"A error...\\n\";\n}\nelse {\n    std::cout \u003c\u003c k-\u003edefault_value() \u003c\u003c std::endl;\n}\n```\n\n## Acknowledgment\n\nThank a lots from Mr. Ghasem Ramezani Manesh for his review and improving this library.\n\nI'm not good in c++ so maybe some parts are not well, In any case you can contribute or improve this one and I would accept and will merge this with love )\n\n© Copyright Max Base\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fcpp-mylanguage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasemax%2Fcpp-mylanguage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fcpp-mylanguage/lists"}