Git Product home page Git Product logo

asp-translator's Introduction

TranslatorFilter

Automatic translation of ASP.NET application. Not only from one language to other. See sample application that replaces all strings to [n] text.

Text in web application will be translated using files: text_original.txt (created automatically when navigating running application) and text_translated.txt. This files located in App_Data folder.

To translate text in application: open text_original.txt, copy its content to google translate, copy translation to text_translated.txt (save as UTF-8) and run application again.

If you want translate only strings, that contains symbols from specific alphabet (for example Russian) open XmlDictionary.cs at line 51 and set your alphabet, then uncomment lines 56, 65 and 66. Currently program translate all text.

Content of project

  • Translator - Translator filter code

  • Mvc - Sample ASP.NET MVC application with filter

  • Classic - Sample ASP.NET Web Forms application with filter

  • packages - Visual Studio will automatically download all library to compile solution

Open TranslatorFilter.sln file and run Mvc or Classic project.

How to use in project

ASP.NET MVC application

  • Add Translator folder files to project (or add reference to Translator.dll)

  • Add attribute 'TranslatorFilter' to Controller to be translated:

    [TranslatorFilter]
    public class CommonController : Controller
    {
    }
  • Run application, it generates text_original.txt and text_translated.txt in App_Data

  • Translate content of text_original.txt in google translate and paste in text_translated.txt (remove extra spaces inserted by Google)

  • Run application again, text will be translated

  • If some strings not translated add them in the begining of text_original.txt and text_translated.txt

ASP.NET classic application or ASP.NET MVC global translation

  • Add Translator folder files to project (or add reference to Translator.dll)

  • Attach filter in Global.asax:

    public class Global : System.Web.HttpApplication
    {
        public Global()
        {
           this.PostRequestHandlerExecute += Global_PostRequestHandlerExecute;
        }
    
        void Global_PostRequestHandlerExecute(object sender, EventArgs e)
        {
            Response.Filter = new TranslatorFilterStream(Response.Filter);
        }
    }

asp-translator's People

Contributors

miptleha avatar

Watchers

 avatar  avatar

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.