Skip to content

Commit

Permalink
added better i18n docs
Browse files Browse the repository at this point in the history
  • Loading branch information
maccesch committed Jan 5, 2025
1 parent 1e22fca commit cc55cec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ These attributes can be applied to the struct itself.
- **`impl_vec_data_provider`** - If given, then [`TableDataProvider`] is automatically implemented for `Vec<ThisStruct>` to allow
for easy local data use. See the [simple example](https://github.com/synphonyte/leptos-struct-table/blob/master/examples/simple/src/main.rs) for more information.
- **`row_type`** - Specifies the type of the rows in the table. Defaults to the struct that this is applied to. See the [custom_type example](https://github.com/synphonyte/leptos-struct-table/blob/master/examples/custom_type/src/main.rs) for more information.
- **`i18n`** - Allows to specify the i18n scope for all fields of the struct as well as the `i18n` module path which defaults to `crate::i18n`. See [I18n](#i18n) for more information.

### Field attributes

Expand All @@ -133,6 +134,7 @@ These attributes can be applied to any field in the struct.
- **`format`** - Quick way to customize the formatting of cells without having to create a custom renderer. See [Formatting](#formatting) below for more information.
- **`getter`** - Specifies a method that returns the value of the field instead of accessing the field directly when rendering.
- **`none_value`** - Specifies a display value for `Option` types when they are `None`. Defaults to empty string
- **`i18n`** - Overrides the i18n key for the field. See [I18n](#i18n) for more information.

#### Formatting

Expand Down Expand Up @@ -343,10 +345,12 @@ Please have a look at the [pagination example](https://github.com/Synphonyte/lep
## I18n

To translate the column titles of the table using `leptos-i18n` you can enable the `"i18n"`
feature. The field names of the struct are used as keys.
feature. The field names of the struct are used as keys by default and can be customized using the `i18n` attribute.

Please have a look at the
[i18n example](https://github.com/Synphonyte/leptos-struct-table/tree/master/examples/i18n).
[i18n example](https://github.com/Synphonyte/leptos-struct-table/tree/master/examples/i18n)
and at the sections [Struct attributes](#struct-attributes) and
[Field attributes](#field-attributes) for more information.

## Contribution

Expand Down
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
//! - **`impl_vec_data_provider`** - If given, then [`TableDataProvider`] is automatically implemented for `Vec<ThisStruct>` to allow
//! for easy local data use. See the [simple example](https://github.com/synphonyte/leptos-struct-table/blob/master/examples/simple/src/main.rs) for more information.
//! - **`row_type`** - Specifies the type of the rows in the table. Defaults to the struct that this is applied to. See the [custom_type example](https://github.com/synphonyte/leptos-struct-table/blob/master/examples/custom_type/src/main.rs) for more information.
//! - **`i18n`** - Allows to specify the i18n scope for all fields of the struct as well as the `i18n` module path which defaults to `crate::i18n`. See [I18n](#i18n) for more information.
//!
//! ## Field attributes
//!
Expand All @@ -124,6 +125,7 @@
//! - **`format`** - Quick way to customize the formatting of cells without having to create a custom renderer. See [Formatting](#formatting) below for more information.
//! - **`getter`** - Specifies a method that returns the value of the field instead of accessing the field directly when rendering.
//! - **`none_value`** - Specifies a display value for `Option` types when they are `None`. Defaults to empty string
//! - **`i18n`** - Overrides the i18n key for the field. See [I18n](#i18n) for more information.
//!
//! ### Formatting
//!
Expand Down Expand Up @@ -376,10 +378,12 @@ pub struct TemperatureMeasurement {
//! # I18n
//!
//! To translate the column titles of the table using `leptos-i18n` you can enable the `"i18n"`
//! feature. The field names of the struct are used as keys.
//! feature. The field names of the struct are used as keys by default and can be customized using the `i18n` attribute.
//!
//! Please have a look at the
//! [i18n example](https://github.com/Synphonyte/leptos-struct-table/tree/master/examples/i18n).
//! [i18n example](https://github.com/Synphonyte/leptos-struct-table/tree/master/examples/i18n)
//! and at the sections [Struct attributes](#struct-attributes) and
//! [Field attributes](#field-attributes) for more information.
//!
//! # Contribution
//!
Expand Down

0 comments on commit cc55cec

Please sign in to comment.