zhiburt / tabled

An easy to use library for pretty print tables of Rust structs and enums.
MIT License
1.94k stars 77 forks source link

feat: add i18n support #412

Closed brianheineman closed 2 months ago

brianheineman commented 2 months ago

Add support for customizing the record template for extended tables so that clients (e.g. https://github.com/theseus-rs/rsql) using this library can localize the template.

zhiburt commented 2 months ago

Hi @brianheineman

I tend to think that the original problem is way simpler :smile: just provide a method to replace "Record" text. So you'd be able to use i18n on your own by just setting this value, you could use different packages, strategies etc.

Something like

ExtendedTable::new(&data)
    .template(|f, index| write!(f, "[ {} {index} ]", localized("record_name")));

What do you think?

And I think we do missing this method, anyway. Let me know if you'd like to contribute.


Good call with introduction of a feature.

Though I am thinking is there somewhere an actual need/feature for i18n, we could provide, probably no?

Or maybe I am totally wrong here; Please correct me in such case.

Take care

brianheineman commented 2 months ago

@zhiburt I really like your suggestion and I updated the PR to reflect the change. Please let me know if there are any other changes you would like to see.

zhiburt commented 2 months ago

Thanks for contribution.

To be honest I doubt when it will be released. I have a few important PRs on the list, which I am struggle to have done for a few month already .............. Hopefully soon :disappointed:

Take care. Have a good weekend.

brianheineman commented 2 months ago

Thanks @zhiburt I appreciate the feedback and quick response!