Comments (7)
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.
Is there a particular scenario where you think would be useful?
from i18n-complete.
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.
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.
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.
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.
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)
- Make sure LocalizationController is only deployed via nuget if it doesn't exist HOT 1
- xgettext behaviour HOT 1
- What is the i18n-Complete license? HOT 1
- Take advantage of Cache HOT 2
- Use using with StreamReader .. HOT 1
- Adding an empty message to the dictionary HOT 1
- Comments are not being added to the dictionary HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from i18n-complete.