惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
C
CERT Recently Published Vulnerability Notes
O
OpenAI News
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
S
Schneier on Security
Latest news
Latest news
F
Full Disclosure
T
Tenable Blog
T
Troy Hunt's Blog
The Last Watchdog
The Last Watchdog
S
Secure Thoughts
L
LangChain Blog
有赞技术团队
有赞技术团队
Project Zero
Project Zero
Cloudbric
Cloudbric
爱范儿
爱范儿
GbyAI
GbyAI
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
The Exploit Database - CXSecurity.com
S
Security @ Cisco Blogs
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
大猫的无限游戏
大猫的无限游戏
Last Week in AI
Last Week in AI
C
Cisco Blogs
WordPress大学
WordPress大学
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V2EX - 技术
V2EX - 技术
Engineering at Meta
Engineering at Meta
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Hacker News: Ask HN
Hacker News: Ask HN
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
M
MIT News - Artificial intelligence
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
K
Kaspersky official blog
The Hacker News
The Hacker News
V
V2EX
F
Fortinet All Blogs
L
LINUX DO - 最新话题
Cisco Talos Blog
Cisco Talos Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
N
News | PayPal Newsroom
博客园 - 三生石上(FineUI控件)
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org

Hub's wlog

Hub's wlog - Dia with GTK 3 Hub's wlog - Dev Log August 2023 Hub's wlog - libopenraw Rust with C API Hub's wlog - Niepce July 2023 updates Hub's wlog - Niepce June 2023 updates Hub's wlog - Life update Hub's wlog - Niepce May 2023 updates Hub's wlog - Niepce April 2023 updates Hub's wlog - Niepce March 2023 updates Hub's wlog - Integrating the RawTherapee engine Hub's wlog - Niepce February 2023 updates Hub's wlog - Implementing i18n-format, a Rust procedural macro Hub's wlog - Niepce January 2023 updates Hub's wlog - Introducing Toot That! Hub's wlog - Niepce December 2022 updates Hub's wlog - Niepce November 2022 updates Hub's wlog - Fall of releases Hub's wlog - Introducing Compiano Hub's wlog - RTKit, portals, and Pipewire Hub's wlog - Release day Hub's wlog - Update on Niepce Hub's wlog - New Again
Hub's wlog - i18n-format for Rust
:: Hubert Figuière · 2023-01-22 · via Hub's wlog

2023.01.22

A quick announcement for i18n-format, a Rust crate to help with string localization. While it's not GNOME specific as it is only about gettext, I wrote it for GNOME applications.

The goal is to allow the use of gettext! and ngettext! while xgettext can still extract the strings.

Simple use:

use i18n_format::i18n_fmt;

let number = 1;
let s = i18n_fmt! {
    i18n_fmt("This is number {}, make it so !", number)
};

In your po/meson.build, make sure to have:

i18n.gettext(gettext_package,
  args [
    '--keyword=i18n_fmt',
    '--keyword=i18n_nfmt:1,2'
  ],
  preset: 'glib')

If you use the regular gtk-rust-template, that's probably all that needs to happen.

Don't forget to check the documentation, or the code.