From cc7f6ccbd311da19750e26a4ac38ace568cb1a29 Mon Sep 17 00:00:00 2001 From: Ziyang Hu Date: Tue, 3 Jan 2023 16:08:15 +0800 Subject: [PATCH] update readme --- cozo-core/README-zh.md | 2 +- cozo-lib-c/README-zh.md | 22 ++++++++------------- cozo-lib-java/README-zh.md | 37 +++++++++++++++--------------------- cozo-lib-java/README.md | 6 +++--- cozo-lib-nodejs/README-zh.md | 2 +- cozo-lib-python/README-zh.md | 2 +- cozo-lib-swift/README-zh.md | 2 +- cozo-lib-wasm/README-zh.md | 2 +- cozorocks/README-zh.md | 2 +- cozoserver/README-zh.md | 2 +- 10 files changed, 33 insertions(+), 46 deletions(-) diff --git a/cozo-core/README-zh.md b/cozo-core/README-zh.md index b39fbef4..2360c97f 100644 --- a/cozo-core/README-zh.md +++ b/cozo-core/README-zh.md @@ -2,4 +2,4 @@ [![Crates.io](https://img.shields.io/crates/v/cozo)](https://crates.io/crates/cozo) -Cozo数据库核心部分的实现。 \ No newline at end of file +Cozo 数据库核心部分的实现。 \ No newline at end of file diff --git a/cozo-lib-c/README-zh.md b/cozo-lib-c/README-zh.md index 3c70365a..944527a2 100644 --- a/cozo-lib-c/README-zh.md +++ b/cozo-lib-c/README-zh.md @@ -1,30 +1,24 @@ -# Cozo C语言库 +# Cozo C 语言库 [![C](https://img.shields.io/github/v/release/cozodb/cozo)](https://github.com/cozodb/cozo/releases) -This directory contains the source of the Cozo C API. +这里是 Cozo 的 C API 的源代码。 -This document describes how to set up the C library. -To learn how to use CozoDB (CozoScript), follow -the [tutorial](https://docs.cozodb.org/en/latest/tutorial.html). You can run all the queries -described in the tutorial with an in-browser DB [here](https://www.cozodb.org/wasm-demo/). +本文叙述的是如何安装设置 Cozo 的 C 语言库。有关如何使用 CozoDB(CozoScript)的信息,见 [文档](https://docs.cozodb.org/zh_CN/latest/index.html) 。 -You can download pre-built libraries from the [release page](https://github.com/cozodb/cozo/releases), -look for those starting with `libcozo_c`. +预编译的库可从 [GitHub 发布页面](https://github.com/cozodb/cozo/releases) 下载,其中 C 语言库以 `libcozo_c` 开头。 -The API is contained in this single [header file](./cozo_c.h). +C 语言的 API 在这个 [头文件](./cozo_c.h) 中。 -An example for using the API is [here](./example.c). - -To build and run the example: +[这个程序](./example.c) 举例说明了如何调用此 API,程序可使用以下命令编译安装: ```bash gcc -L../target/release/ -lcozo_c example.c -o example && ./example ``` -# Building Cozo from source +# 从源码编译 -You need to install the [Rust toolchain](https://www.rust-lang.org/tools/install) on your system. Then: +首先需要安装 [Rust 工具链](https://www.rust-lang.org/tools/install) ,然后: ```bash cargo build --release -p cozo_c -F compact -F storage-rocksdb diff --git a/cozo-lib-java/README-zh.md b/cozo-lib-java/README-zh.md index 4e826bee..0c12bacf 100644 --- a/cozo-lib-java/README-zh.md +++ b/cozo-lib-java/README-zh.md @@ -1,38 +1,31 @@ -# Cozo Java语言库 +# Cozo Java 语言库 -This crate provides the JNI bindings for using Cozo in Java/JVM languages/Android. +这里是 Cozo 的 JNI 接口库,可以在 Java/JVM 语言/安卓中使用。 -You do not use this crate directly. Instead, use: +一般情况下,这个库不是直接使用的。用于应当使用以下调用此库的库: -* ... for Java or other JVM languages -* ... for Clojure on JVM (you can also use the Java library, but this one is nicer) -* ... for Android +* [Cozo Java](https://github.com/cozodb/cozo-lib-java):在 JVM Java 中使用 +* [Cozo Clojure](https://github.com/cozodb/cozo-clj):在 JVM Clojure 中使用 +* [Cozo Android](https://github.com/cozodb/cozo-lib-android):在安卓中使用 -Keep reading only if the prebuilt binaries provided by these libraries do not suit your needs. +下面几个小节介绍在上面几个库不支持你的平台时如何从源码编译此库。 -## Building for JDK +## 为 JDK 编译 -With the Rust toolchain installed, +首先安装 Rust 工具链,然后: ```bash cargo build --release -p cozo_java -F storage-rocksdb ``` -## Building for Android +## 为安卓编译 -Building for Android is not easy, and we will be very sketchy. +为安卓编译较为复杂,以下仅做简要叙述。 -The first thing to note is that you should omit `-F storage-rocksdb` from the build command above, -unless you are prepared to manually change lots of `build.rs` flags in -[cozorocks](../cozorocks) to build the RocksDB dependency. +首先,在编译时请不要使用 `-F storage-rocksdb` 选项,除非你有能力在 `build.rs` 中做出大量调整使得 [cozorocks](../cozorocks) 能够成功为安卓编译。 -Then, in addition to adding Android targets to the Rust toolchain, -you also need to set up the Android NDK -cross-compilation and libraries paths, etc. -This is notoriously hard to get right, but fortunately -you can just use the Docker image [here](https://github.com/cross-rs/cross) -which has everything set up for you. +然后,在 Rust 工具链中添加安卓目标,设置好安卓 NDK 以及其编译路径、库路径等。手动搞定这些非常复杂,不过 [这里](https://github.com/cross-rs/cross) 有一些系统镜像可以省去你不少工作。 -When everything is set up correctly, the following command show complete without errors: +所有上面所述都设置好了之后,执行下面命令就可以编译安卓库了: ```bash for TARGET in aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android; do @@ -40,4 +33,4 @@ for TARGET in aarch64-linux-android armv7-linux-androideabi i686-linux-android x done ``` -For running on modern Android phones, the single target `aarch64-linux-android` is probably enough. \ No newline at end of file +上面编译了多个架构的安卓库。如果只是想在常见的安卓手机平板上运行,`aarch64-linux-android` 一个目标其实就够了。 \ No newline at end of file diff --git a/cozo-lib-java/README.md b/cozo-lib-java/README.md index ecf0ab22..13e33312 100644 --- a/cozo-lib-java/README.md +++ b/cozo-lib-java/README.md @@ -4,9 +4,9 @@ This crate provides the JNI bindings for using Cozo in Java/JVM languages/Androi You do not use this crate directly. Instead, use: -* ... for Java or other JVM languages -* ... for Clojure on JVM (you can also use the Java library, but this one is nicer) -* ... for Android +* [Cozo Java](https://github.com/cozodb/cozo-lib-java) for Java or other JVM languages +* [Cozo Clojure](https://github.com/cozodb/cozo-clj) for Clojure on JVM (you can also use the Java library, but this one is nicer) +* [Cozo Android](https://github.com/cozodb/cozo-lib-android) for Android Keep reading only if the prebuilt binaries provided by these libraries do not suit your needs. diff --git a/cozo-lib-nodejs/README-zh.md b/cozo-lib-nodejs/README-zh.md index 413005c6..b79bf53b 100644 --- a/cozo-lib-nodejs/README-zh.md +++ b/cozo-lib-nodejs/README-zh.md @@ -1,4 +1,4 @@ -# Cozo NodeJS库 +# Cozo NodeJS 库 [![cozo-node](https://img.shields.io/npm/v/cozo-node)](https://www.npmjs.com/package/cozo-node) diff --git a/cozo-lib-python/README-zh.md b/cozo-lib-python/README-zh.md index 8033f5cb..cd967b42 100644 --- a/cozo-lib-python/README-zh.md +++ b/cozo-lib-python/README-zh.md @@ -1,4 +1,4 @@ -# Cozo Python库 +# Cozo Python 库 [![pypi](https://img.shields.io/pypi/v/cozo_embedded)](https://pypi.org/project/cozo_embedded/) diff --git a/cozo-lib-swift/README-zh.md b/cozo-lib-swift/README-zh.md index bf24fffd..decf2bb3 100644 --- a/cozo-lib-swift/README-zh.md +++ b/cozo-lib-swift/README-zh.md @@ -1,4 +1,4 @@ -# Cozo Swift库(仅支持苹果硬件) +# Cozo Swift 库(仅支持苹果硬件) [![pod](https://img.shields.io/cocoapods/v/CozoSwiftBridge)](https://github.com/cozodb/cozo/tree/main/cozo-lib-swift) diff --git a/cozo-lib-wasm/README-zh.md b/cozo-lib-wasm/README-zh.md index 6408c5ed..f8555fb8 100644 --- a/cozo-lib-wasm/README-zh.md +++ b/cozo-lib-wasm/README-zh.md @@ -1,4 +1,4 @@ -# Cozo WASM库 +# Cozo WASM 库(浏览器) This crate provides Cozo web assembly modules for browsers. If you are targeting NodeJS, use [this](../cozo-lib-nodejs) instead: diff --git a/cozorocks/README-zh.md b/cozorocks/README-zh.md index a9b34cf5..25b0ab4d 100644 --- a/cozorocks/README-zh.md +++ b/cozorocks/README-zh.md @@ -1,3 +1,3 @@ # Cozorocks -对RocksDB C++接口的封装。 \ No newline at end of file +对 RocksDB C++ 接口的封装。 \ No newline at end of file diff --git a/cozoserver/README-zh.md b/cozoserver/README-zh.md index 39f08070..f7783b35 100644 --- a/cozoserver/README-zh.md +++ b/cozoserver/README-zh.md @@ -1,4 +1,4 @@ -# CozoServer +# CozoServer(独立服务) [![server](https://img.shields.io/github/v/release/cozodb/cozo)](https://github.com/cozodb/cozo/releases)