go - Output all language strings in Revel? -
i'm developing api server in go , server (at moment) handles translations clients. when api client fetches particular data asks translations available given section.
ideally want have following folder structure:
/messages /home.en /home.fr /home.sv /news.en /news.fr /news.sv
where news
, home
distinct modules.
now question have revel is possible fetch language strings given module , given locale? example pull home strings en-us.
edit:
i output (something can return client) key:value string of translations.
any guidance appreciated.
it seems me revel uses messaged based translation (just gettext does), need original string translation. these strings stored in config objects, stored in messages
of i18n.go, sorted language.
as can see, mapping not exported, can't access it. best way fix write function want (getting config supplying language) or exporting 1 of existing functions , create pull request revel.
you may workaround copying code of loadmessagefile
or forking version of revel , exporting loadmessagefile
or parsemessagesfile
. great opportunity create pull request.
note localizations stored in ini file format parsed robfig/config
, manually parsing option (although not recommended).
Comments
Post a Comment