{{announcement.body}}
{{announcement.title}}

Translate your Enterprise apps in 1 second

DZone 's Guide to

Translate your Enterprise apps in 1 second

In this article the author demonstrates how you can translate all your Enterprise apps in 1 second, by simply clicking a button.

· Web Dev Zone ·
Free Resource

I must have seen dozens of implementations of this exact same web app during my 25 years as an Enterprise developer. And to be honest with you, I'm tired of implementing the exact same app, over and over again. "Don't reinvent the wheel" comes to mind. Hence, I decided I wanted to create a "micro service web app", providing me with all translation features I could possibly need in the future. And more interestingly, I will create the entire app, in 1 second, by simply clicking a button. If you don't believe me, feel free to watch the following YouTube video, where I demonstrate how I solve all my translations needs, for the rest of my life, in 1 second.


The SQL script I am starting out with can be found below.

MySQL
 




xxxxxxxxxx
1
18


1
create database `babelfish`;
2
use `babelfish`;
3
 
          
4
create table `languages` (
5
  `locale` varchar(5) not null,
6
  `language` varchar(128) not null,
7
  primary key (`locale`)
8
);
9
insert into languages (`locale`, `language`) values ('en', 'English');
10
 
          
11
create table `translations`(
12
  `locale` varchar(5) not null,
13
  `key` varchar(128) not null,
14
  `content` text not null,
15
  primary key (`locale`, `key`),
16
  constraint `translations_languages_fky` foreign key (`locale`) references `languages` (`locale`)
17
);
18
 
          


Below you can find the HTML Angular code I used in the video for creating the dropdown select list, to select which locale to use.

HTML
 




x


 
1
  <app-selector
2
    *ngIf="canEditColumn('locale')"
3
    key="locale"
4
    value="language"
5
    [model]="data.entity"
6
    [getItems]="service.languages_Get({})"
7
    class="entity-edit-field">
8
  </app-selector>
9
 
          


And you're done. 1 relatively mighty second some might argue. Or to use an analogy ...

One small second for you, one huge second for your enterprise development efforts

If you don't know how to setup Magic, you can watch the following video.

Below you can find some additional resources.

In addition to Magic, you will need to have the dotnet CLI, Angular CLI, NodeJs and some database - Either MySQL or Microsoft SQL Server. If you choose the latter, you'll have to slightly modify the above SQL script to accommodate for SQL Server's syntax.

Topics:
.net core 3, angular, rest api, sql

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}