Using cargo readme to generate README.
This commit is contained in:
parent
4a5a093961
commit
afc034d924
36
README.md
36
README.md
|
@ -2,30 +2,36 @@
|
||||||
[![Crates.io](https://img.shields.io/crates/v/ki18n)](https://crates.io/crates/ki18n)
|
[![Crates.io](https://img.shields.io/crates/v/ki18n)](https://crates.io/crates/ki18n)
|
||||||
[![Documentation](https://docs.rs/ki18n/badge.svg)](https://docs.rs/ki18n/)
|
[![Documentation](https://docs.rs/ki18n/badge.svg)](https://docs.rs/ki18n/)
|
||||||
|
|
||||||
KI18n is a cross-platform internationalization framework used by KDE applications. This crate is meant to allow using KI18n with Rust and [qmetaobject-rs](https://github.com/woboq/qmetaobject-rs) crate.
|
## Introduction
|
||||||
|
KI18n is a cross-platform internationalization framework used by KDE applications. This crate
|
||||||
|
is meant to allow using KI18n with Rust and [qmetaobject-rs](https://github.com/woboq/qmetaobject-rs) crate.
|
||||||
|
|
||||||
# Motivation
|
## Motivation
|
||||||
I love KDE. I have been using it as my primary DE for quite a while. I also like Rust Programming Language. Currently, it is nearly impossible to use any KDE frameworks from Rust without some C++ FFI. While FFI is never easy, complexity with C++ is exponentially more than plain C due to the Object-Oriented nature of C++, which is entirely different from Rust's somewhat functional design.
|
I love KDE. I have been using it as my primary DE for quite a while. I also like Rust Programming Language.
|
||||||
|
Currently, it is nearly impossible to use any KDE frameworks from Rust without some C++ FFI. While FFI is
|
||||||
|
never easy, complexity with C++ is exponentially more than plain C due to the Object-Oriented nature of C++,
|
||||||
|
which is entirely different from Rust's somewhat functional design.
|
||||||
|
|
||||||
If possible, I would like the Tier-1 KDE Frameworks to be usable from pragmatic Rust in a somewhat natural fashion. I am currently interested in KDE frameworks that are usable with QML.
|
If possible, I would like the Tier-1 KDE Frameworks to be usable from pragmatic Rust in a somewhat natural
|
||||||
|
fashion. I am currently interested in KDE frameworks that are usable with QML.
|
||||||
|
|
||||||
# Requirements
|
## Requirements
|
||||||
This crate requires KF5I18n to be installed or at least present in the system.
|
This crate requires KF5I18n to be installed or at least present in the system.
|
||||||
## Ubuntu
|
### Ubuntu
|
||||||
``` shell
|
``` shell
|
||||||
sudo apt install libkf5i18n-dev
|
sudo apt install libkf5i18n-dev
|
||||||
```
|
```rust
|
||||||
## Arch Linux
|
## Arch Linux
|
||||||
``` shell
|
``` shell
|
||||||
sudo pacman -S ki18n
|
sudo pacman -S ki18n
|
||||||
```
|
```
|
||||||
|
|
||||||
# Custom Location for KF5I18n
|
## Custom Location for KF5I18n
|
||||||
The crate searches from KF5I18n using either the environment variables (KF5_I18n_INCLUDE_PATH and KF5_I18n_LIBRARY_PATH) if they are set or just
|
The crate searches from KF5I18n using either the environment variables (`KF_VERSION`,
|
||||||
searches at /usr/include /usr/library
|
`KF_INCLUDE_PATH` and `KF_LIBRARY_PATH`) if they are set or uses `kf5-config` to find the paths.
|
||||||
|
|
||||||
|
|
||||||
# Example
|
## Example
|
||||||
```rust
|
```rust
|
||||||
use cstr::cstr;
|
use cstr::cstr;
|
||||||
use qmetaobject::prelude::*;
|
use qmetaobject::prelude::*;
|
||||||
|
@ -39,19 +45,19 @@ fn main() {
|
||||||
import QtQuick.Controls 2.0 as Controls
|
import QtQuick.Controls 2.0 as Controls
|
||||||
import QtQuick.Layouts 1.2
|
import QtQuick.Layouts 1.2
|
||||||
import org.kde.kirigami 2.13 as Kirigami
|
import org.kde.kirigami 2.13 as Kirigami
|
||||||
|
|
||||||
// Base element, provides basic features needed for all kirigami applications
|
// Base element, provides basic features needed for all kirigami applications
|
||||||
Kirigami.ApplicationWindow {
|
Kirigami.ApplicationWindow {
|
||||||
// ID provides unique identifier to reference this element
|
// ID provides unique identifier to reference this element
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// Window title
|
// Window title
|
||||||
// i18nc is useful for adding context for translators, also lets strings be changed for different languages
|
// i18nc is useful for adding context for translators, also lets strings be changed for different languages
|
||||||
title: i18nc("@title:window", "Hello World")
|
title: i18nc("@title:window", "Hello World")
|
||||||
|
|
||||||
// Initial page to be loaded on app load
|
// Initial page to be loaded on app load
|
||||||
pageStack.initialPage: Kirigami.Page {
|
pageStack.initialPage: Kirigami.Page {
|
||||||
|
|
||||||
Controls.Label {
|
Controls.Label {
|
||||||
// Center label horizontally and vertically within parent element
|
// Center label horizontally and vertically within parent element
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
5
README.tpl
Normal file
5
README.tpl
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# KI18n Crate for Rust
|
||||||
|
[![Crates.io](https://img.shields.io/crates/v/ki18n)](https://crates.io/crates/ki18n)
|
||||||
|
[![Documentation](https://docs.rs/ki18n/badge.svg)](https://docs.rs/ki18n/)
|
||||||
|
|
||||||
|
{{readme}}
|
33
src/lib.rs
33
src/lib.rs
|
@ -1,13 +1,34 @@
|
||||||
//! # KI18n-rs
|
//! # Introduction
|
||||||
//! KI18n is a cross-platform internationalization framework used by KDE applications. This crate is meant to allow using KI18n with
|
//! KI18n is a cross-platform internationalization framework used by KDE applications. This crate
|
||||||
//! Rust and [qmetaobject-rs](https://github.com/woboq/qmetaobject-rs) crate.
|
//! is meant to allow using KI18n with Rust and [qmetaobject-rs](https://github.com/woboq/qmetaobject-rs) crate.
|
||||||
|
//!
|
||||||
|
//! # Motivation
|
||||||
|
//! I love KDE. I have been using it as my primary DE for quite a while. I also like Rust Programming Language.
|
||||||
|
//! Currently, it is nearly impossible to use any KDE frameworks from Rust without some C++ FFI. While FFI is
|
||||||
|
//! never easy, complexity with C++ is exponentially more than plain C due to the Object-Oriented nature of C++,
|
||||||
|
//! which is entirely different from Rust's somewhat functional design.
|
||||||
|
//!
|
||||||
|
//! If possible, I would like the Tier-1 KDE Frameworks to be usable from pragmatic Rust in a somewhat natural
|
||||||
|
//! fashion. I am currently interested in KDE frameworks that are usable with QML.
|
||||||
|
//!
|
||||||
|
//! # Requirements
|
||||||
|
//! This crate requires KF5I18n to be installed or at least present in the system.
|
||||||
|
//! ## Ubuntu
|
||||||
|
//! ``` shell
|
||||||
|
//! sudo apt install libkf5i18n-dev
|
||||||
|
//! ```
|
||||||
|
//! ## Arch Linux
|
||||||
|
//! ``` shell
|
||||||
|
//! sudo pacman -S ki18n
|
||||||
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! # Custom Location for KF5I18n
|
//! # Custom Location for KF5I18n
|
||||||
//! The crate searches from KF5I18n using either the environment variables (KF5_I18n_INCLUDE_PATH and KF5_I18n_LIBRARY_PATH) if they are set or just
|
//! The crate searches from KF5I18n using either the environment variables (`KF_VERSION`,
|
||||||
//! searches at /usr/include /usr/library
|
//! `KF_INCLUDE_PATH` and `KF_LIBRARY_PATH`) if they are set or uses `kf5-config` to find the paths.
|
||||||
|
//!
|
||||||
//!
|
//!
|
||||||
//! # Example
|
//! # Example
|
||||||
//! ```ignore
|
//! ```rust
|
||||||
//! use cstr::cstr;
|
//! use cstr::cstr;
|
||||||
//! use qmetaobject::prelude::*;
|
//! use qmetaobject::prelude::*;
|
||||||
//! use ki18n::KLocalizedContext;
|
//! use ki18n::KLocalizedContext;
|
||||||
|
|
Loading…
Reference in a new issue