{"id":21586122,"url":"https://github.com/magiclen/opencc-rust","last_synced_at":"2025-04-10T20:20:40.280Z","repository":{"id":44546120,"uuid":"153192702","full_name":"magiclen/opencc-rust","owner":"magiclen","description":"Open Chinese Convert(OpenCC, 開放中文轉換) binding for the Rust language for conversion between Traditional Chinese and Simplified Chinese.","archived":false,"fork":false,"pushed_at":"2023-11-13T13:25:56.000Z","size":3990,"stargazers_count":26,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-03T04:47:49.956Z","etag":null,"topics":["opencc","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/magiclen.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":"2018-10-15T23:06:03.000Z","updated_at":"2024-08-10T14:31:38.081Z","dependencies_parsed_at":"2024-08-10T14:31:35.424Z","dependency_job_id":"70837a7e-3ac2-43b2-8d20-b78fbe4cb643","html_url":"https://github.com/magiclen/opencc-rust","commit_stats":{"total_commits":52,"total_committers":1,"mean_commits":52.0,"dds":0.0,"last_synced_commit":"da4cfd865012e0663aebbf35e6b074f0f5377756"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fopencc-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fopencc-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fopencc-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fopencc-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magiclen","download_url":"https://codeload.github.com/magiclen/opencc-rust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248289840,"owners_count":21078921,"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":["opencc","rust"],"created_at":"2024-11-24T15:12:44.373Z","updated_at":"2025-04-10T20:20:40.264Z","avatar_url":"https://github.com/magiclen.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"OpenCC Rust\n====================\n\n[![CI](https://github.com/magiclen/opencc-rust/actions/workflows/ci.yml/badge.svg)](https://github.com/magiclen/opencc-rust/actions/workflows/ci.yml)\n\nOpen Chinese Convert(OpenCC, 開放中文轉換) binding for the Rust language for conversion between Traditional Chinese and Simplified Chinese.\n\n## Compilation\n\nTo compile this crate, you need to compile the OpenCC C++ library first. You can install OpenCC in your operating system, or in somewhere in your file system. As for the latter, you need to set the following environment variables to link the OpenCC library:\n\n* `OPENCC_LIB_DIRS`: The directories of library files, like `-L`. Use `:` to separate.\n* `OPENCC_LIBS`: The library names that you want to link, like `-l`. Use `:` to separate. Typically, it contains **opencc:marisa**.\n* `OPENCC_INCLUDE_DIRS`: The directories of header files, like `-i`. Use `:` to separate.\n* `OPENCC_STATIC`: Whether to use `static` or `dylib`.\n* `OPENCC_DYLIB_STDCPP`: If you use `static` linking, and your OpenCC library is compiled by the GNU C, this environment variable should be set.\n* `OPENCC_STATIC_STDCPP`: If you use `static` linking, and your OpenCC library is compiled by musl libc, this environment variable should be set.\n\n## Examples\n\n```rust\nuse opencc_rust::*;\n\nlet opencc = OpenCC::new(DefaultConfig::TW2SP).unwrap();\n\nlet s = opencc.convert(\"涼風有訊\");\n\nassert_eq!(\"凉风有讯\", \u0026s);\n\nlet s = opencc.convert_to_buffer(\"，秋月無邊\", s);\n\nassert_eq!(\"凉风有讯，秋月无边\", \u0026s);\n```\n\n```rust\nuse opencc_rust::*;\n\nlet opencc = OpenCC::new(DefaultConfig::S2TWP).unwrap();\n\nlet s = opencc.convert(\"凉风有讯\");\n\nassert_eq!(\"涼風有訊\", \u0026s);\n\nlet s = opencc.convert_to_buffer(\"，秋月无边\", s);\n\nassert_eq!(\"涼風有訊，秋月無邊\", \u0026s);\n```\n\n## Static Dictionaries\n\nUsually, OpenCC needs to be executed on an environment where OpenCC is installed. If you want to make it portable, you can enable the `static-dictionaries` feature.\n\n```toml\n[dependencies.opencc-rust]\nversion = \"*\"\nfeatures = [\"static-dictionaries\"]\n```\nThen, the `generate_static_dictionary` and `generate_static_dictionaries` functions are available.\n\nThe default OpenCC dictionaries will be compiled into the binary file by `lazy_static_include` crate. And you can use the two functions to recover them on demand.\n\nFor example,\n\n```rust\nuse opencc_rust::*;\n\nlet output_path = \"/path/to/dictionaries-directory\";\n\ngenerate_static_dictionary(\u0026output_path, DefaultConfig::TW2SP).unwrap();\n\nlet opencc = OpenCC::new(Path::join(\u0026output_path, DefaultConfig::TW2SP)).unwrap();\n\nassert_eq!(\"凉风有讯\", \u0026opencc.convert(\"涼風有訊\"));\n```\n\n## Supported Platforms\n\nThis crate currently supports **Linux**. Other platforms are not guaranteed.\n\n## Crates.io\n\nhttps://crates.io/crates/opencc-rust\n\n## Documentation\n\nhttps://docs.rs/opencc-rust\n\n## License\n\n[Apache-2.0](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclen%2Fopencc-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagiclen%2Fopencc-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclen%2Fopencc-rust/lists"}