How to support multilingual for angular Website - angular11

I am beginner to Angular. i do not know how do support a website for multilingual using angular 11.And i have some dynamic contents in the website .I want this to include the multilingual support. can anyone please help me

There are different solutions. You can use angular built in i18n (https://angular.io/guide/i18n-overview). But it requires handling bundles with server because angular i18n creates separate bundle for each language you want in your application. For example, if user switches to english you should load bundle for english language and reload the page and same for other languages.
Another one is Transloco (https://ngneat.github.io/transloco/) which is popular. It will allow you change i18n in runtime without creating multiple bundles. You need to configure app to work with this package and create json files with keys and translated values for each language. Transloco has good documentation and examples.
Another popular is ngx-translate (https://github.com/ngx-translate/core) which works similar to Transloco.
Also if your project is small you can handle translations manually (update/add new ones) but in case of large project better way is to upload i18n resource files to 3rd party services where translator will translate everything and you can then import translated files to your project.
So it depends of your project which one to select but you can compare advantages and disadvantages and choose necessary.

Related

Can I include PHP templates in a TWIG base template or vice versa?

I am currently in the process of refactoring and restructuring an existing Symfony 2 application.
There are a few base templates and all other templates inherit from them. Right now, all the templates are PHP. I am planning to migrate the application to TWIG.
The problem is that this application is already in use and while migrating I am also expected to add new features to the application. This means I can not freeze the current state of the application, fully migrate to TWIG and then continue working with that.
This means that a migration to TWIG is only possible in small steps, i.e. I can only migrate a handful of templates before I have to deploy a new release. There will also be some new templates for the features I am adding and I would also prefer to add these in TWIG format.
My plan right now is to migrate the base templates to TWIG first and then include the existing PHP templates in those new base templates. Afterwards, I would continue migrating the other templates in small batches.
Looking at documentation online, it is possible to have both the PHP and TWIG template engines enabled simultaneously. However, I could not find any tutorials, examples or documentation mentioning that you could not only have those two engines side by side but also have templates from one engine include templates from the other engine.
Is there a way to mix templates from those two engines as I described?
Even if there are similarities between both engines (they still do the very same thing), they are working internally in their own ways, the architecture and the code are very different.
Templates provided in PHP are managed by the Templating Component.
Templates provided in Twig are managed by the Twig engine.
Have a look to both codes, and you'll understand why we just can't compare/mix them.
For example:
slots from php engine plays with string overwriting
blocks from twig engine plays with class overloading
So even if you were able to access the twig-compiled file using a tricky import, you'll not be able to overload a block by the simple fact that your php template isn't a class.

Localization Information (Globalization)

As at 2013 what is the best practice for multi language multi culture localization of web pages.
Should I store all the translations in a database? for language etc?
Should I build resx files based on a database query or should I simply create resx files?
The application will be used with a browser interface across multiple devices and platforms e.g. Windows/IOS/Android. Are there any additional things I should think about.
best regards
Shrekito
There are a few types of global content you will usually have to deal with:
Application templates such as HTML pages, menus, and emails sent by your app
Dynamic content stored in your database
App templates
Templates are typically handled using your own framework's internationalization (i18n) framework. In the case of asp.net, the framework includes libraries to mark strings and export them to (English) .resx files. This supports a lot of built-in features such as variables, plurals, and developer comments. So unless you're facing some actual blockers, you typically want to go with it instead of building your own i18n framework (eg. in-database, or in-DB with .resx export).
Nowadays, the workflow decisions come when you actually want to get those files localized. In the old days you'd exchange the files with an agency using email. In 2013, web apps have a fast-paced development cycle with multiple releases per week (or per day), so there is a much bigger need for automation. Teams are switching away from using a VCS, FTP or Dropbox as a temporary storage for their files to modern localization (L10n) management platforms like Transifex (discl: I'm the founder) to manage their localization process.
The best way to remove the L10n pain from developers is to integrate your L10n platform with your build tools, so whenever you commit something, the English files are sent automatically to the L10n system, which will detect the changes and notify the right translators. When you're ready to deploy, your integration will pull the fresh translated files automatically.
With Transifex, you can use the Tx Client app with a git-commit hook, your build/CI system or your ol' good deploy script:
tx push --source
tx pull -l de,fr,it --mode=reviewed --minimum-perc=90
Dynamic and External content
This type of content is typically not handled using .resx files since it's easier to manage it in your DB itself. Typically, you want to store this content along with your template content so that translators have a single place to look at everything.
The platform you choose will need to have a modern API to work with. Check out the Transifex API on how these look like.
Other tips and tricks
Choose a platform which has a strong built-in web-based translation editor. Translators need solid features such as Translation Memory, Glossary, Machine Translation to deliver quality and consistent translations.
Follow good i18n practices such as good date formatting and avoiding concatenation.
Love your translators. They're the ones who make it all happen.

Drupal multilingual

Apart from the module of i18n, is there any other module to build a multilingual site with Drupal?
If you don't want to use the many i18n-based modules, Drupal 6 already ships with Locale and Content Translation, however this can get cucumbersome if you have a lot of contents to translate.
The Translation Management or Localization Client modules would help on that regard.
You could get more ideas on this page: http://drupal.org/node/254214
You can use other modules like:
https://www.drupal.org/project/gtranslate
https://www.drupal.org/project/gtrans
with these modules you don't need to add translated content manually for each languages.
But of course these modules uses 3rd party services to translate, so not efficient always.
So I suggest to use:
Internationalization with Localization update
Its work like charm, I am currently using it.
And you can also use entity translation which allows you to do field level translation .You can translate a field also if required using this module
Translation Management Tool (https://www.drupal.org/project/tmgmt) is a recent module.The Translation Management Tool (TMGMT) module provides a tool set for translating content from different sources. The translation can be done by people or translation services of all kinds. It builds on and uses existing language tools and data structures in Drupal and can be used in automated workflow scenarios.
With i18n you have to install other modules like l10n_update, language dropdown, language icons, translation overview, variable. These are some of the module which make your multi language drop-down easy to use.

How to support multiple languages in an ASP.NET web application?

I am working on a web forms application that needs to support multiple languages based on a user's preference. Here are some considerations to keep in mind about the needed solution:
I want to avoid using resource files to store the different text translations because I'd like the ability to change them without having to recompile and deploy the application.
Also the translations ideally need to be adminstratable.
It seems its a considerable amount of effort to add this support to an existing application. Any suggestions would be appreciated. Thanks.
Rick Strahl has and awesome solution that is free for personal use, src available here via SVN:
West Wind Web & Ajax Toolkit for ASP.NET
Data Driven Localization Resource Provider
Database driven Localization lets you store resources in a SQL Server database.
Interactive Web based Resource
Adminstration provides a live Web
based adminstration for that can edit
and update resources while the app is
running
Resource Editing Control associates
icons with each localizable control
and allows jumping directly to the
administration form with the current
resource id and locale selected.
Resx Import and Export lets you
import existing Resx resources,
interactively edit them with the data
driven provider, then export them
back out as Resx resources.
Localization Utilities like a
JavaScript Resource Handler,
functions to embed localized script
values and much more.
You'll need languge tables for each supported language. You may need to start with an "en" table as your base language for the app.
Then you can add tables for en-gb, en-us and if required you can even go brand specific using custom cultures like en-gb-MyApp1, en-gb-myApp2
Make extensive use of caching and write a custom resource provider.
I blogged about my design of an E-commerce store where products, pages etc. are stored in database, and saved in multiple languages by storing column data in XML format.

Django apps equivalent in ASP.NET MVC?

I currently develop with Django, but want to be ready when a future client inevitably requests a site done in ASP.NET MVC. While most of the structure and flow of ASP.NET MVC is more or less identical to Django and RoR, the one part I'm not sure about is the Apps methodology Django employs to make code reuse easier.
Is there an equivalent to Django apps in ASP.NET MVC? That is, can I create a feature, like tagging, comments, calendar of events, simple blog, etc. and bundle it up, making it portable to other projects with a minimum of glue code required to integrate it? Perhaps some kind of plugin or module system?
Django doesn't follow the traditional MVC pattern, since they advocate that in the Web world, their MTV is more suitable. In the overall, I prefer Django over Rails because of the django apps. You can do almost the same in RoR with the Rails vendor plugins, but it's not the same.
ASP.NET follows RoR structure, and therefor you don't have the reusable apps. If you check the folder structure in a MVC project, you don't even find the RoR's Plugin folder, so I bet you should do it VisualStudio-Like.
Create a reusable app, as a separated project, include references for that project in your main one, and in your Route file, just redirect to the other project's controllers.
This might be of interest as well: App Areas
we've tried to do something similar, albeit from a different angle. we use compositional controllers for increased reusability in bistro, and an ndjango as the templating language. what we start to see is controllers become more granular, and as a result less dependent on where they reside - more componentizable.

Resources