nicksnyder / go-i18n

Translate your Go program into multiple languages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Is there any way for reverse lookup in bundle?

IvanProgramming opened this issue · comments

commented

I have localized string from user in telegram bot and want to get back localization ID for identifying message. If there are no any template variables in this text, how can I get message ID of localized string.

I tried to figure it out inspecting source code, but, as I understand there are no ways to do it using, excepting the way of loading raw localization from resource files as maps and going through values.

So, is there any way to do it thorugh localizer, or bundle?

This library does not support reverse lookup like you are describing.

You could use the exported ParseMessageFileBytes function to construct your own reverse index if you wish.