turquoiseowl / i18n

Smart internationalization for ASP.NET
Other
556 stars 156 forks source link

What is the minimum setup to get a C# backend running? #340

Closed eestein closed 7 years ago

eestein commented 7 years ago

I read the instructions, but as far as I understood from my reading there's quite a few things I'm not going to need.

I have an ASP.NET WebAPI backend in which I basically need to translate only the business exceptions thrown to the user. I already have an angular2 front end handling translations independently. I read about the translation module configuration using the web.config and so on, but my question is, since I'll be using the lib only for C# code - no URL i18n, or anything - could I just install the NuGet package and it would work?

If so, where would I setup the information regarding available languages, .PO files like:


  <appSettings>
    ...
    <add key="i18n.DirectoriesToScan" value=".." /> <!-- Rel to web.config file -->
    <add key="i18n.WhiteList" value="*.cs;*.cshtml;*.sitemap" />
    <add key="i18n.BlackList" value=".\js\kendo;.\js\angular" />
    <add key="i18n.AvailableLanguages" value="en-US;fr-FR;pt-BR" />
    ...
  </appSettings>

Thank you!

turquoiseowl commented 7 years ago

i18n works somewhat differently to normal GetText applications, and is pretty much dependent on i18n.LocalizingModule being installed.

Please see https://github.com/turquoiseowl/i18n/issues/50 for a detailed explanation.

eestein commented 7 years ago

Thank you for your answer. So would you recommend anything other than your lib for my need? I agree with your post and Resource lookup is bad... but your lib seems to be the only one showing up on Google with acceptable usage and maintenance. If you of any lib for my case, I'd appreciate it if you could share it.

turquoiseowl commented 7 years ago

I think there are several ports of GNU GetText for C#. First google result is this:

https://github.com/neris/NGettext

HTH

eestein commented 7 years ago

Ok, thank you.