1570863932
In this article, we will discuss Internationalization in Angular 8 using ngx-translate library.
NGX-Translate is an internationalization library for Angular. Internationalization is the process of translating an application into multiple languages. Using this library, we can translate our application language into multiple languages. This will work with not only static data, but dynamic data as well.
If you’re new to Angular, then you can follow this tutorial on getting started.
Angular is a TypeScript-based, open source web application framework developed by Google. Angular is a platform for building mobile, desktop, and web applications.
You may also like: To Writing Clean code in Angular - What do you need to do?.
TypeScript is an open source programming language developed and maintained by Microsoft. TypeScript is a superset of JavaScript that compiles to plain JavaScript.
Development Environment Required Software,
npm install -g @angular/cli
Create a new Angular project by using the following command. First, we need to set a path for creating a new angular app.
ng new MultilanguageApp
Creating a new Angular project
Now, open this project in Visual Studio Code. To open this in Visual Studio Code, choose the project path and run below command.
code .
Now, install the ngx-translate library by using the following commands. We can install bootstrap and jquery for design.
npm install @ngx-translate/core --save
npm install @ngx-translate/http-loader --save
npm install bootstrap@4 jquery –save
Example of how to run the previous commands:
Output of previous commands
After installing the bootstrap package, we have to add reference of the CSS file on the styles.css
file. To do this, fun the following command:
@import "~bootstrap/dist/css/bootstrap.css";
Import the necessary modules into app.module.ts.
Installing necessary modules
Now, expand the src folder and right-click on the Assets folder. Add a new folder under it and rename that to “i18” and add JSON files to this folder (based on how many languages you want to translate. I’m showing an example of two language English and French so I’m creating two files).
en.json
fr.json
The JSON file is a combination of a key-value pair.
Examples:
Example of JSON file
Example of key-value pairs
Open the en.json file and paste the following code
{
"Addemployee": "Add-employee",
"Name": "Name",
"Email": "Email",
"PhoneNo": "Phone No",
"Submit": "Submit",
"Cancel": "Cancel",
"Home": "Home",
"Employee": "Employee",
"EmployeeList": "Employee List"
}
Open fr.json file and paste the following code.
{
"Addemployee": "Ajouter employé",
"Name": "prénom",
"Email": "Email",
"PhoneNo": "Pas de téléphone",
"Submit": "Soumettre",
"Cancel": "Annuler",
"Home": "Accueil",
"Employee": "Employée",
"EmployeeList": "Liste des employés"
}
Open the app.component.html file and paste the following code.
Welcome to {{ title }}!
{{ lang }}
{{ 'Home' | translate }}
{{ 'Employee' | translate }}
{{ 'EmployeeList' | translate }}
[EmployeeList(Reload)](employeelist "EmployeeList(Reload)") -->
Ex.
Declaring key and translating text
Open the app.component.ts file and paste the following code.
import { Component } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'MultilanguageApp';
constructor(
public translate: TranslateService) {
translate.addLangs(['en', 'fr']);
if (localStorage.getItem('locale')) {
const browserLang = localStorage.getItem('locale');
translate.use(browserLang.match(/en|fr/) ? browserLang : 'en');
} else {
localStorage.setItem('locale', 'en');
translate.setDefaultLang('en');
}
}
changeLang(language: string) {
localStorage.setItem('locale', language);
this.translate.use(language);
}
}
Ex.
Import service on constructor
Run this command for hosting the application with default port 4200.
Running the command on port 4200
Final output
In this article, we discussed ngx-translate with a demo example.
NGX-Translate is an internationalization library for Angular. Internationalization is the process of translating our application into multiple languages. In my next article, I will discuss an Angular i18n language translator and Paypal subscription payment integration using Angular 8. Any feedback related to this article is most welcome!
Thank for reading! Please share if you liked it!
#angular #angular-js #web-development
1598940617
Angular is a TypeScript based framework that works in synchronization with HTML, CSS, and JavaScript. To work with angular, domain knowledge of these 3 is required.
In this article, you will get to know about the Angular Environment setup process. After reading this article, you will be able to install, setup, create, and launch your own application in Angular. So let’s start!!!
For Installing Angular on your Machine, there are 2 prerequisites:
First you need to have Node.js installed as Angular require current, active LTS or maintenance LTS version of Node.js
Download and Install Node.js version suitable for your machine’s operating system.
Angular, Angular CLI and Angular applications are dependent on npm packages. By installing Node.js, you have automatically installed the npm Package manager which will be the base for installing angular in your system. To check the presence of npm client and Angular version check of npm client, run this command:
· After executing the command, Angular CLI will get installed within some time. You can check it using the following command
Now as your Angular CLI is installed, you need to create a workspace to work upon your application. Methods for it are:
To create a workspace:
#angular tutorials #angular cli install #angular environment setup #angular version check #download angular #install angular #install angular cli
1598716260
Angular 8 CRUD is a basic operation to learn Angular from scratch. We will learn how to build a small web application that inserts, read data, update and delete data from the database. You will learn how to create a MEAN Stack web application. In this Angular 8 Tutorial Example, you will learn a new framework by building a crud application.
You check out the new features in brief on my Angular 8 New Features post.
I have designed this Angular 8 CRUD Tutorial, especially for newcomers, and it will help you to up and running with the latest version of Angular, which is right now 8.
#angular #angular 8 #angular 8 crud
1595344320
Corona Virus Pandemic has brought the world to a standstill.
Countries are on a major lockdown. Schools, colleges, theatres, gym, clubs, and all other public places are shut down, the country’s economy is suffering, human health is on stake, people are losing their jobs and nobody knows how worse it can get.
Since most of the places are on lockdown, and you are working from home or have enough time to nourish your skills, then you should use this time wisely! We always complain that we want some ‘time’ to learn and upgrade our knowledge but don’t get it due to our ‘busy schedules’. So, now is the time to make a ‘list of skills’ and learn and upgrade your skills at home!
And for the technology-loving people like us, Knoldus Techhub has already helped us a lot in doing it in a short span of time!
If you are still not aware of it, don’t worry as Georgia Byng has well said,
“No time is better than the present”
– Georgia Byng, a British children’s writer, illustrator, actress and film producer.
No matter if you are a developer (be it front-end or back-end) or a data scientist, tester, or a DevOps person, or, a learner who has a keen interest in technology, Knoldus Techhub has brought it all for you under one common roof.
From technologies like Scala, spark, elastic-search to angular, go, machine learning, it has a total of 20 technologies with some recently added ones i.e. DAML, test automation, snowflake, and ionic.
Every technology in Tech-hub has n number of templates. Once you click on any specific technology you’ll be able to see all the templates of that technology. Since these templates are downloadable, you need to provide your email to get the template downloadable link in your mail.
These templates helps you learn the practical implementation of a topic with so much of ease. Using these templates you can learn and kick-start your development in no time.
Apart from your learning, there are some out of the box templates, that can help provide the solution to your business problem that has all the basic dependencies/ implementations already plugged in. Tech hub names these templates as xlr8rs (pronounced as accelerators).
xlr8rs make your development real fast by just adding your core business logic to the template.
If you are looking for a template that’s not available, you can also request a template may be for learning or requesting for a solution to your business problem and tech-hub will connect with you to provide you the solution. Isn’t this helpful 🙂
To keep you updated, the Knoldus tech hub provides you with the information on the most trending technology and the most downloaded templates at present. This you’ll be informed and learn the one that’s most trending.
Since we believe:
“There’s always a scope of improvement“
If you still feel like it isn’t helping you in learning and development, you can provide your feedback in the feedback section in the bottom right corner of the website.
#ai #akka #akka-http #akka-streams #amazon ec2 #angular 6 #angular 9 #angular material #apache flink #apache kafka #apache spark #api testing #artificial intelligence #aws #aws services #big data and fast data #blockchain #css #daml #devops #elasticsearch #flink #functional programming #future #grpc #html #hybrid application development #ionic framework #java #java11 #kubernetes #lagom #microservices #ml # ai and data engineering #mlflow #mlops #mobile development #mongodb #non-blocking #nosql #play #play 2.4.x #play framework #python #react #reactive application #reactive architecture #reactive programming #rust #scala #scalatest #slick #software #spark #spring boot #sql #streaming #tech blogs #testing #user interface (ui) #web #web application #web designing #angular #coronavirus #daml #development #devops #elasticsearch #golang #ionic #java #kafka #knoldus #lagom #learn #machine learning #ml #pandemic #play framework #scala #skills #snowflake #spark streaming #techhub #technology #test automation #time management #upgrade
1625142062
AngularJS was introduced in the year 2009, by Google. AngularJS is a software framework used worldwide by developers. The entire base of this framework is open source. AngularJS has gained popularity among developers because of how it has become for them to create web applications. AngularJS helps in building apps that require less work and reduces the use of unnecessary codes. AngularJS application development is a javascript framework. AngularJS has a clear goal to make the entire process simpler, it also helps app development process and operations as much as it could. AngularJS is used for building applications that support MVC (model view controller) and SPAs (single page web apps) coding and programming structures. AngularJS has been used by some of the top companies in the world to simplify their app development process, like, Google, Paypal, Udemy, mobile site in iPad for HBO, etc. To read more click on the link.
#hire angular js developer #hire dedicated angular js developer #angular js application development #hire dedicated angular js team #hire best angular js application developer
1598727360
Angular 8 Updates And Summary of New Features is today’s topic. Angular 8 arrives with an impressive list of changes and improvements including the much-anticipated Ivy compiler as an opt-in feature. You can check out Angular 7 features and updates if you have not seen yet. In this blog, we have written some articles about Angular 7 Crud, Angular 7 Routing, Angular ngClass, Angular ngFor.
See the following updates.
Angular 8.0 is now supported TypeScript 3.4, and even requires it, so you will need to upgrade.
You can look at what TypeScript 3.3 and TypeScript 3.4 brings on the table on official Microsoft blog.
#angular #typescript #angular 7 crud #angular 7 routing #angular 8