Giter Club home page Giter Club logo

Comments (7)

dotnetwise avatar dotnetwise commented on June 12, 2024

We didn't need to generate it yet, because we are using xgettext to scan all your source code and generate .PO and .POT files
You should run Properties/Localize.bat
That will be automatically run when you compile in release mode. You can change it in your .csproj as it is an MSBuild task

from i18n-complete.

dotnetwise avatar dotnetwise commented on June 12, 2024

Is there a particular scenario where you think would be useful?

from i18n-complete.

mdmoura avatar mdmoura commented on June 12, 2024

As you I also use the methods _( ... ) in my application for translation.
But I was considering using something like [[[ message to localize ]]].
This is already being used by Angular.js and other applications.

Then I can have something like [[[message to localize /// comment]]] ... Or something else.

Having a class with a few methods which would look in files for such patterns and build the PO files would be useful. So I was considering using your approach but with [[[ ]]] ...

from i18n-complete.

mdmoura avatar mdmoura commented on June 12, 2024

BTW, don't you have an HTTP Module? I mean, when and where do you load the PO file for the current language ... I suppose this would be done on an HTTP Module, no?

from i18n-complete.

dotnetwise avatar dotnetwise commented on June 12, 2024

I think the limitation that comes here is xgettext which is pretty limited as the development stopped by 2009 or so.

Looks like for angularjs syntax there is already a module that can generate .po files.
Check it out. http://angular-gettext.rocketeer.be/

So, the question is rather, how can we merge the two .po files together so only having one .po file per language for all the source code (angular, c#, javascript etc.)

We don't need a HTTP module. For Javascript we do export a file called messages.json.
For C# / Razor (.chstml) You simply write _("some stuff {0}", arg).
That method is defined in the controller and the view if you inherit from LocalizableController and specify

    <pages pageBaseType="System.Web.Mvc.LocalizableWebViewPage">

into your ~/Views/Web.config

from i18n-complete.

dotnetwise avatar dotnetwise commented on June 12, 2024

I18NComplete seems smart enough, when loading .po files, it supports multiple files for the same language.
So you can have:

angular.en.po
i18n.en.po
``

They will be both loaded automatically.

if (!Localizations.TryGetValue(cultureHash, out l))
{
l = new Localization();
l.LoadFromFile(filename);
Localizations.Add(cultureHash, l);
}
else l.LoadFromFile(filename);

from i18n-complete.

mdmoura avatar mdmoura commented on June 12, 2024

I see ... That makes sense. At the moment I am doing something similar to you.

The main problem I have with mine / yours approach is using it in Attributes and other places like validators and so on ... I went for the same approach as in I18NComplete which creates LocalizedValidators and so on ...

But if I place [[[something]]] in attributes, cs code, and so on and intersect then on an HTTP Module then I can use localization everywhere without the need of using so many classes to allow the use of the _ methods.

I think I maybe build another version of I18NComplete using [[[ ]]] and compare the two ...

from i18n-complete.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.