Git Product home page Git Product logo

aspnetskeleton2's People

Contributors

adams85 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

aspnetskeleton2's Issues

Extractor: how to add context to POFile

Hello,

Thank you again for this neat project! When I used the (much more limited) po implementation from the Orchard project, one thing I found very practical was that the message context of every translatable string was the source code surrounding the call to the translation component. For example, if a source file contained:

<div>
    <h1 class="display-4">@T["Welcome"]</h1>
    <p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>

The resulting po file would contain something like:

#| msgctxt "<h1 class="display-4">@T["Welcome"]</h1>"
#| msgid "Welcome"
msgid "Welcome"
msgstr "Bienvenue"

And if I remember correctly it even contained the preceding line and the next line. This additional context is most of the time very useful to determine what would be the best translation in a foreign language.

Could you please point me to the place that I would need to modify in the source code to have a similar behavior? Right now, the message context is set to the path of the file which is much less useful. Another problem is that an absolute path is specific to the computer of the developer running the extractor tool, therefore this would not play well in a team context if several developers need to add translatable strings. For many reasons, setting the context to the source code seems to be the way to go.

POTools localizable string extractor

Hello,

I'm opening this issue simply because I have no other way of contacting you - you may delete this in the future, if it becomes obsolete.

I've been looking at different solutions for using GetText .po files within .NET projects and your solutions seem to be the most solid. A combination of your Karambolo.PO library, the text extraction tool and custom string localizers contained in this repository allow for a full-circle implementation of i18n through .po files -- extract texts, generate .po files, read localized strings from .po files through .NET Core built-in facilities.

While testing your approach, I've stumbled on a few questions and I was wondering if you'd be interested in addressing them:

  1. Would you be interested in releasing the POTools project (now contained in this repo) as a separate repository, which could be publicly published on NuGet and thus easily available to be included in different kinds of projects as a .NET CLI Tool?
  2. When extracting strings to be localized from .cs and .cshtml, is there a good reason why you're matching the strings based on the member name (T["Some string"]) instead of matching them based on the type of the member (IStringLocalizer)? Would that impact performance, or was that simply an arbitrary decision to do it that way?
  3. When scanning files from which strings are extracted, without any special handling (something like scan | grep | extract), /bin/ files are taken into account, which is usually not desirable. Would it make sense to have an option to exclude certain directories within the specified path, or maybe even ignore the obvious directories like bin and obj?

I am posing these questions because I'm interested in building a solution that I can use throughout my different projects. I'm willing to contribute and invest some time into this, in order to find a universal solution that I can use long-term.

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.