tasuren / overkami

An application that allows you to add wallpaper to any window.
https://freedom-wall.tasuren.jp
BSD 4-Clause "Original" or "Old" License
25 stars 3 forks source link

build(deps): bump rust-i18n from 1.2.2 to 2.0.0 #73

Closed dependabot[bot] closed 1 year ago

dependabot[bot] commented 1 year ago

Bumps rust-i18n from 1.2.2 to 2.0.0.

Release notes

Sourced from rust-i18n's releases.

v2.0.0

What's New

  • Add multiple formats *.{yml,yaml,json, toml} longbridgeapp/rust-i18n#38
  • Add Backend trait for allows us to customize the difference translations storage.
  • Rewrite code to generate for use backend as code result to allows extending backend.
  • Add public API i18n() method, this is Backend instance.

Breaking Changes

  • available_locales method has removed, use rust_i18n::available_locales!() instead.
  • Refactor crate rust_i18n_support internal APIs, private some methods.

How to extend backend

Write a struct that implements the Backend trait, and then implement the methods in the trait.

use rust_i18n::Backend;

pub struct MyBackend { trs: HashMap<String, HashMap<String, String>>, }

impl MyBackend { fn new() -> Self { let trs = HashMap::new(); trs.insert("en".to_string(), { let mut trs = HashMap::new(); trs.insert("hello".to_string(), "Hello MyBackend".to_string()); trs.insert("welcome".to_string(), "Welcome to use MyBackend".to_string()); trs });

    return Self {
        trs
    };
}

}

impl Backend for MyBackend { fn available_locales(&self) -> Vec<String> { todo!() }

fn translate(&amp;self, locale: &amp;str, key: &amp;str) -&gt; Option&lt;String&gt; {
    // Write your own lookup logic here.
    // For example load from database
    return self.trs.get(locale)?.get(key).cloned();
}

</tr></table>

... (truncated)

Commits
  • 81fe0db Update README
  • 7bde139 Improve t! macro avoid string allocate for missing key.
  • 38e2dde Add benchmark result for t! macro.
  • 4bafbe0 Merge pull request #39 from longbridgeapp/feat/backend
  • ea381cb Add benchmark for t! method.
  • 17ce4b7 Let Backend#translate return &str not string.
  • 6bc3eac Add doc for Extend Backend.
  • eb84db4 Add rust_i18n::available_locales! macro.
  • 376a906 Add backend option for i18n! macro for extend backend.
  • 3d1c889 Add extend for Backend for extend with CombinedBackend.
  • Additional commits viewable in compare view


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)