-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
javascript-localization.html
618 lines (602 loc) · 39.7 KB
/
javascript-localization.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style id="antiClickjack">
body {
display:none !important;
}
</style>
<script type="text/javascript">
if (self === top) {
var antiClickjack = document.getElementById("antiClickjack");
antiClickjack.parentNode.removeChild(antiClickjack);
} else {
top.location = self.location;
}
</script>
<meta name="description" content="JavaScript Localization: In this article we provide a step-by-step guide to internationalize (i18n) your javascript applications using different approaches.">
<meta property="og:title" content="JavaScript localization: A step-by-step introductory guide">
<meta property="og:description" content="JavaScript Localization: In this article we provide a step-by-step guide to internationalize (i18n) your javascript applications using different approaches.">
<meta name="twitter:title" content="JavaScript localization: A step-by-step introductory guide">
<meta name="twitter:description" content="JavaScript Localization: In this article we provide a step-by-step guide to internationalize (i18n) your javascript applications using different approaches.">
<meta name="author" content="inweso GmbH">
<meta name="copyright" content="inweso GmbH">
<meta name="keywords" content="localization,internationalization,localize,translate,locize,l10n,i18n,javascript,nodejs,localization as a service,saas translation,saas localization,laas,continuous localization,DevOps,process,free,website localization,service,software,web app,web,mobile,desktop,game,translation management,online,automate,process of localization,localization process,translation service,localization service,translation software,landing page,javascript localize,localization tool,localizing a website,localization solution,cloud localization,cloud translation,serverless,cloud,cdn,react,react.js,reactjs,react-i18next,next,next.js,nextjs,next-i18next,svelte,svelte-i18n,svelte-i18next,angular,vue,vue-js,jquery,nodejs,i18next,json,api,react-native,localization api,translation api,app localization services,localization management platform,localization platform,professional translation and localization services,website translation management,app localization service,online translation management,i18next translation management,i18next translation,manage translations,manage translation files">
<meta property="og:type" content="website">
<meta property="og:url" content="https://locize.com">
<meta property="og:site_name" content="locize - continuous localization as a service">
<meta property="og:locale" content="en">
<meta property="og:image" content="img/locize_color.svg">
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@locize">
<meta name="slack-app-id" content="A71NM84Q6">
<link href="/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="lib/fontawesome/css/fontawesome.min.css">
<link rel="stylesheet" href="lib/fontawesome/css/brands.min.css">
<link rel="stylesheet" href="lib/fontawesome/css/solid.min.css">
<link rel="stylesheet" href="lib/fontawesome/css/regular.min.css">
<link rel="stylesheet" href="/lib/simple-line-icons/css/simple-line-icons.css">
<link rel="stylesheet" href="/lib/device-mockups/device-mockups.min.css">
<link href="/css/main.min.css" rel="stylesheet">
<!--if lt IE 9
script(src='https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js')
script(src='https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js')
-->
<link href="//cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.css" rel="stylesheet" type="text/css">
<title>JavaScript localization: A step-by-step introductory guide</title>
<link rel="canonical" href="/javascript-localization.html">
</head>
<body id="page-top">
<nav class="navbar navbar-default navbar-fixed-top affix" id="mainNav" i18next-options="{"ns": "common"}">
<div class="container">
<div class="navbar-header">
<button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"><span class="sr-only">Toggle navigation</span><i class="fa-solid fa-bars"></i></button><a class="navbar-brand" href="/"></a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown" id="featuresd"><a class="dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Features<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/#features">Characteristics</a></li>
<li><a href="/#process">What is the software localization process?</a></li>
<li><a href="/#platform">What can our localization platform do?</a></li>
<li><a href="/how-it-works.html">How it works</a></li>
<li><a href="/for-your-team.html">For your team</a></li>
</ul>
</li>
<li><a href="/pricing.html">Pricing</a></li>
<li><a href="/customers.html">Success Stories</a></li>
<li class="dropdown" id="featuresd"><a class="dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">More<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="https://docs.locize.com/">Documentation</a></li>
<li><a href="/services.html">Additional services</a></li>
<li> <a href="/blog/">Blog</a></li>
<li><a class="closeOnClick" href="/#contact">Contact</a></li>
</ul>
</li>
<li><a href="https://www.locize.app/login" target="_blank">Login<i class="fa-solid fa-lock" aria-hidden="true" style="margin-left: 5px;"></i></a></li>
<li><a class="btn btn-outline btn-xl" href="https://www.locize.app/register" style="background-color: #4caf50; color: white; border: none;">Start your free trial</a></li>
</ul>
</div>
</div>
</nav>
<div style="margin-top: 50px;">
<section class="section-white" id="introduction" style="padding-bottom:0">
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="section-heading">
<h1>JavaScript localization:<br>A step-by-step introductory guide</h1>
<p>The process of converting your JavaScript code to multiple languages during the internationalization of your project. I18N means to design software in the way it can handle multiple locations, languages or regions. </p>
<p>There are a lot of possibilities out there, but we have definitely the most advanced platform for any use-case of i18n.</p><br><br>
<p>This step-by-step-guide helps you to start your software-localization project based on a JavaScript environment. </p><br><br>
<h3>Table of contents</h3>
<ul class="nav">
<li class="nav-item"><a class="nav-link" href="#start">Prepare your app</a></li>
<li class="nav-item"><a class="nav-link" href="#library">Choose your framework</a></li>
<li class="nav-item"><a class="nav-link" href="#bestpractices">Best practices</a></li>
<li class="nav-item"><a class="nav-link" href="#internationalize">Checklist multiple languages</a></li>
<li class="nav-item"><a class="nav-link" href="#automate">Automate translation work</a></li>
<li class="nav-item"><a class="nav-link" href="#faq">Frequently asked questions</a></li>
</ul>
</div>
</div>
<div class="col-md-6"><img class="img-responsive" src="img/localization/javascript-localization.png" alt="javascript localization" loading="lazy"></div>
</div>
</div>
</section>
<section class="section-white gettingstarted" id="start" style="padding:0">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="section-heading">
<h2>Prepare your app</h2>
<p>locize can be used with any i18n framework. Even with no i18n framework at all, for example with the locizify script.</p>
<h3>Example by i18next</h3>
<p>
Below we will continue with i18next as i18n framework.
If you're curious to know why we suggest i18next, have a look at <a href="/i18next.html">this page</a>.
</p><br>
<p>To have multiple languages on your website or application with
<i18next></i18next>, follow the below steps. First install the dependencies, use the following <a href="https://www.npmjs.com/package/i18next" title="npm package">npm package</a> or use a script tag load umd, esm or cjs from unkpg or cdnjs.com CDN.
</p><br><br>
<pre><code># npm
$ npm install i18next --save
# yarn
$ yarn add i18next</code></pre><br><br>
<h3>Localization in JavaScript example</h3>
<p>
These lines of code give you a brief overview about localization in JavaScript can work and what functions are available in 18next
. If you want to use the library for JavaScript production please refer to the detailed instructions of each framework in our resources. There is a much easier integration than with innerHTML.<br><br>
<pre><code>import i18next from 'i18next';
i18next.init({
lng: 'en',
debug: true,
resources: {
en: {
translation: {
"key": "hello world"
}
}
}
}, (err, t) => {
// initialized and ready to go!
document.getElementById('output').innerHTML = i18next.t('key');
});</code></pre><br>
<p>Check out the <a href="https://www.i18next.com/overview/getting-started" target="_blank">i18n </a> getting started guide on the i18next page.</p>
</p>
<h3>Do you already know i18next?</h3>
<h4>Then just use <a href="https://github.com/locize/i18next-locize-backend" target="_blank">i18next-locize-backend</a> as i18next backend.</h4>
<figure>
<pre><code>import i18next from 'i18next';
import Backend from 'i18next-locize-backend';
i18next
.use(Backend)
.init({
// ...other options
backend: {
projectId: '[PROJECT_ID]',
apiKey: '[API_KEY]',
referenceLng: '[LNG]'
}
});</code></pre>
</figure>
</div>
</div>
</div>
</div>
</section>
<section class="section-tertiary library text-center" id="library">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<div class="section-heading" style="margin-bottom: 20px;">
<h2>Choose your framework</h2>
<p class="head" style="margin-bottom: 20px;">
For famous JavaScript frameworks locize is very easy to integrate through the <a href="https://www.i18next.com/" title="javascript-localization-library">JavaScript localization library</a> i18next.</p><a class="btn btn-outline btn-xl watch-yt-video-btn" href="https://youtu.be/SA_9i4TtxLQ" target="_blank" style="background-color: #15419a!important">Watch: i18next Crash Course</a>
<div class="embed-responsive embed-responsive-16by9 yt-video" style="display: none;">
<iframe class="embed-responsive-item" width="100%" height="250" src="https://www.youtube-nocookie.com/embed/SA_9i4TtxLQ?rel=0&controls=0&showinfo=0" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
</div>
<hr>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="container-fluid">
<div class="row">
<div class="col-md-6"><img class="img-responsive" src="img/localization/react.png" alt="javascript localization react" style="max-width: 250px" loading="lazy"><br><br>
<p class="text-left">Read the detailed instructions for using <a href="https://react.i18next.com/" title="i18next react">react-i18next</a> for your project.</p><br><br>
<p class="text-left">Basic procedure of using React:</p><br>
<ul class="nav text-left">
<li class="nav-item">1. Installation of i18next package needed</li>
<li class="nav-item">2. Add react-i18next to expand the functionality</li>
<li class="nav-item">3. Add a new file i18n.js inside same directory as index.js</li>
<li class="nav-item">4. Translate the content with "hook", "HOC" or "render prop"</li>
</ul><br>
<p class="text-left">For more detailed instructions on how to properly internationalize a React app, check out <a href="/blog/react-i18next/">this tutorial blog post about React localization</a>.</p>
</div>
<div class="col-md-6"><img class="img-responsive" src="img/localization/angular.png" alt="angular" style="max-width: 250px" loading="lazy"><br><br>
<p class="text-left">Read the detailed instructions for using <a href="https://github.com/Romanchuk/angular-i18next" title="i18next angular">angular-i18next</a> for your project.</p><br><br>
<p class="text-left">Basic procedure of using Angular:</p><br>
<ul class="nav text-left">
<li class="nav-item">1. Installation of i18next and angular-i18next package needed</li>
<li class="nav-item">2. Import I18NextModule to AppModule</li>
<li class="nav-item">3. Import I18NextModule.forRoot() to App Module<br>and setup provider with "init"</li>
<li class="nav-item">4. Use i18next pipe to translate key</li>
</ul><br>
<p class="text-left">To unleash the full power of <a href="https://github.com/Romanchuk/angular-i18next" target="_blank">angular-i18next</a> check out <a href="/blog/angular-i18next/">this tutorial blog post about Angular localization</a>.</p>
</div>
</div>
<div class="row" style="margin-top: 80px;">
<div class="col-md-6"><img class="img-responsive" src="img/localization/vue.png" alt="vue" style="max-width: 250px" loading="lazy"><br><br>
<p class="text-left">Read the detailed instructions for using <a href="https://i18next.github.io/i18next-vue/" title="i18next vue">i18next-vue</a> for your project.</p><br><br>
<p class="text-left">Basic procedure of using Vue:</p><br>
<ul class="nav text-left">
<li class="nav-item">1. Installation of <code style="font-size: 75%;">i18next</code> and <code style="font-size: 75%;">i18next-vue</code></li>
<li class="nav-item">2. Initialize i18next</li>
<li class="nav-item">3. Initial setup with <code style="font-size: 75%;">app.use(I18NextVue, {i18next})</code></li>
<li class="nav-item">4. Set up a view</li>
</ul><br>
<p class="text-left">For more detailed instructions on how to properly internationalize a Vue app, check out <a href="/blog/i18next-vue/">this tutorial blog post about Vue localization</a>.</p>
<p class="text-left">As an alternative to <a href="https://github.com/i18next/i18next-vue" target="_blank">i18next-vue</a>, you can try <a href="https://kazupon.github.io/vue-i18n/" target="_blank">vue-i18n</a> like described in <a href="/blog/give-vue-i18n-more-superpowers/">this tutorial blog post</a>.</p>
</div>
<div class="col-md-6"><img class="img-responsive" src="img/localization/supported-frameworks.png" alt="supported frameworks" style="max-height: 250px" loading="lazy"><br><br>
<p class="text-left">There are more <a href="https://www.i18next.com/overview/supported-frameworks" title="i18next vue">supported frameworks</a> like .Net, <a href="/blog/next-i18next/" target="_blank">Next.js</a>, Svelte, Elm and more. Check them out now.</p><br>
<p class="text-left">i18next can also be used on server side...<br>In <a href="/blog/how-does-server-side-internationalization-look-like/" target="_blank">this tutorial blog post</a> you can check out how this works.</p>
<p class="text-left">On <a href="https://docs.locize.com/integration/instrumenting-your-code#other-options">this page</a> you'll find also non i18next aproaches.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="section-white bestpractices" id="bestpractices" style="padding-bottom:0">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="section-heading">
<h2>Checklist best practices</h2>
<p>These questions will help you to find the best setup to internationalize with JavaScript.</p>
<div style="background:#b7cbd4;padding:3rem;margin:2rem 0">
<ul style="list-style-type:none;color:black;margin:1rem 0;">
<li style="margin:1rem 0;"><i style="font-size:3rem;" class="far fa-square"></i> For which javascript-environment are you looking for an i18n solution?</li>
<li style="margin:1rem 0;"><i style="font-size:3rem;" class="far fa-square"></i> Do you need a language detector for your environment?</li>
<li style="margin:1rem 0;"><i style="font-size:3rem;" class="far fa-square"></i> Do you want to bundle the translations with your app?</li>
<li style="margin:1rem 0;"><i style="font-size:3rem;" class="far fa-square"></i> Do you want to load the translations separate from your app via http?</li>
<li style="margin:1rem 0;"><i style="font-size:3rem;" class="far fa-square"></i> Do you want to manage your translations with an awesome translation management system?</li>
</ul>
</div>
<p>
There is also a more detailed<a href="https://www.i18next.com/overview/supported-frameworks" title="i18next vue"> guide for first setup help</a> at i18next directly, which covers also more than just javascript.</p>
</div>
</div>
</div>
</div>
</section>
<section class="section-white internationalize" id="internationalize" style="padding:0">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="section-heading">
<h2>Step-by-step code implementation (the manual way)</h2>
<p>This process is based on how to implement multiple languages for a sample React app.</p>
<p>For more detailed instructions on how to properly internationalize your project, shown with the help of a React app example, check out this tutorial blog post: <a href="/blog/react-i18next/" target="_blank">"How to properly internationalize a React application using i18next"</a></p><br>
<ul class="text-left">
<li>Install i18next and appropriate framework package</li>
<li>Install the browser language-detector</li>
<li>Prepare the i18next configuration</li>
<li>Translate the content with "hook", "HOC" or "render prop"</li>
<li>Create a language switcher</li>
<li>Add translations for other languages</li>
<li>Use pluralization and interpolation</li>
<li>Use packages for date and time formatting with interpolation</li>
<li>Use the context function for gender specific translations</li>
<li>Separate translations from code, for web applications use i18next-locize-backend</li>
</ul><br><br>
<p>But there is more.... </p>
<p>Take a minute and read about <b>automating</b> this process with a <b>smart translation</b> management system below. For extensive projects using just a library may too inefficient. </p>
</div>
</div>
</div>
</div>
</section>
<section class="section-white automate" id="automate" style="padding:0">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="section-heading">
<h2>Automate translation work (the smart way)</h2>
<p>Congratulations you have decided to read about a robotic way to switch the language for any type of software. So this is for you. It's awesome which functionalities you can unleash for a small amount of money. Watch our videos and admire what you get from only five USD per month.</p><br><br>
<div class="div" style="display:flex;flex-wrap:wrap;align-items: stretch;">
<div class="div" style="width:500px;margin: 2rem;"><a class="btn btn-outline btn-xl watch-yt-video-btn" href="https://youtu.be/osScyaGMVqo" target="_blank" style="background-color: #15419a!important">Watch: react-i18next and locize</a>
<div class="embed-responsive embed-responsive-16by9 yt-video" style="display: none;">
<iframe class="embed-responsive-item" width="100%" height="250" src="https://www.youtube-nocookie.com/embed/osScyaGMVqo?rel=0&controls=0&showinfo=0" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
</div>
</div>
<div class="div" style="width:500px;padding: 2rem;">
<p>Use the full power of the i18next library together with locize, a <a href="/" title="localization management platform">localization management platform</a> by the founders of i18next, which can automate the translation workflow in the locize app.</p>
</div>
<div class="div" style="width:500px;margin: 2rem;"><a class="btn btn-outline btn-xl watch-yt-video-btn" href="https://youtu.be/VfxBpSXarlU" target="_blank" style="background-color: #15419a!important">Watch: automatic machine translation</a>
<div class="embed-responsive embed-responsive-16by9 yt-video" style="display: none;">
<iframe class="embed-responsive-item" width="100%" height="250" src="https://www.youtube-nocookie.com/embed/VfxBpSXarlU?rel=0&controls=0&showinfo=0" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
</div>
</div>
<div class="div" style="width:500px;padding: 2rem;">
<p>The machine / generative AI translation feature enables every new content to get automatically translated into all other defined target languages (like Google Translate, Deepl, Open AI, Mistral AI).</p>
<div style="border-left: 5px solid red">
<p style="margin: 1rem;"><a href="https://www.locize.app/register" title="Register for free">Register for free</a> and unlock everything for a 14 days trial period.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="section-white faq" id="faq" style="padding:0">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="section-heading">
<h2>Frequently asked questions</h2>
<h3>What is JavaScript localization?</h3>
<p>Read the <a href="#introduction" title="introduction">introduction</a> to this page about internationalization (also known as i18n) of JavaScript software (client or server side). Localization (also known as l10n) is more about the content. The translator, developer or project manager prepares texts, graphics, sounds etc. so you can target a specific language or region.</p>
<h3>How to make my JavaScript app multilingual (open source)?</h3>
<p>Use an i18n framework (like i18next) of your choice and instrument your code respectively. Navigate to the <a href="#internationalize" title="detailed checklist">detailed checklist</a> to know how to make a JavaScript application multilingual.</p>
<h3>What is i18n (internationalization)?</h3>
<p>Software products are primarily prepared for your main-market and -language. During the internationalization of a software product new market targets will be added. Adjusting your software to handle this new markets with languages, locales and regions is called i18n process. Learn more about internationalization and what is used for in our complete guide with the title <a href="/blog/what-is-i18n/" title="what is i18n">"what is i18n"</a>.</p>
<h3>How can I have multiple languages on my website?</h3>
<p>Decide which JavaScript framework to use. Then install the i18next npm-package and next add the "i18next.init" code to your application. Follow the <a href="#start" title="javascript example">JavaScript example</a> to take your first steps with i18next. Or just read our article about <a href="/blog/website-localization/" title="website localiaztion">website localization</a>. </p>
</div>
</div>
</div>
</div>
</section>
<section class="section-white conclusion" id="conclusion" style="padding:0">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="section-heading">
<h2>Now it's your turn</h2>
<p>We hope this step-by-step-guide was helpful... <b>Best for javascript localization</b> is to start with the <a href="#bestpractices" title="best practices questions">best practices questions</a> we provided above. There are several methods to choose from in order to successfully localize your project with JavaScript: First of all, if you only need to switch the language for an application, it might be easier to use a javascript translation library like i18next or our locizify script. If you have a huge project with various components to be internationalized and you want to keep up with time, then it might be a good opportunity to use a complete translation management solution like locize. </p><br>
<div style="border-left: 5px solid red">
<p style="margin: 1rem;">Since we're offering you a free 14-day trial for locize, there might be a good chance to test all included features anyway. <a href="https://www.locize.app/register" title="Register now for the free">Register now for the free</a> trial period and start your best experience with localizing an application. </p>
<p style="margin: 1rem;">Or if you can't make the decision to register right away, visit our <a href="/website-localization-services.html" title="website localization service">website localization service</a> page for more information on how to manage website-localization.</p>
</div><br>
<p>If you decide that you do not need a translation-management, you should follow the guides and video instructions for the specified framework (react, angular or vue).</p><br>
<p>In any case <b>the javascript-library to choose</b> is "i18next" because of the following properties: </p><br>
<ul>
<li>Richness (splitting translations to multiple files, string interpolation, plugins for <b>detect language</b>)</li>
<li>Maturity (for any use-case) </li>
<li>Extensibility (for all modern javascript framework, jquery, laravel and more). </li>
</ul><br>
<p>Now we like to invite you to share that to any developer, project manager or business this would help.</p>
<p>Recommend our step-by-step-guide on <a href="https://www.facebook.com/sharer/sharer.php?u=https://locize.com/javascript-localization.html" target="_blank"><i class="fa-brands fa-facebook" style="font-size:2.5rem"></i></a><a href="https://x.com/intent/tweet?url=https://locize.com/javascript-localization.html" target="_blank"><i class="fa-brands fa-x-twitter" style="font-size:2.5rem"></i></a></p>
</div>
</div>
</div>
</div>
</section>
<script>
window.enableCookiesHook = function () {
$('.yt-video').show();
$('.watch-yt-video-btn').hide();
};
window.disableCookiesHook = function () {
$('.yt-video').hide();
$('.watch-yt-video-btn').show();
};
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://locize.com/javascript-localization.html"
},
"headline": "JavaScript localization: A step-by-step introductory guide",
"image": "https://locize.com/img/localization/javascript-localization.png",
"author": {
"@type": "Person",
"name": "Sandro Huber"
},
"publisher": {
"@type": "Organization",
"name": "inweso GmbH",
"logo": {
"@type": "ImageObject",
"url": "https://locize.com/img/locize_white.svg"
}
},
"datePublished": "2021-05-14",
"dateModified": "2021-05-19"
}
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [{
"@type": "Question",
"name": "What is JavaScript localization?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Read the introduction to this page about internationalization (also known as i18n) of JavaScript software (client or server side). Localization (also known as l10n) is more about the content. The translator, developer or project manager prepares texts, graphics, sounds etc. so you can target a specific language or region."
}
},{
"@type": "Question",
"name": "How to make my JavaScript app multilingual (open source)?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Use an i18n framework (like i18next) of your choice and instrument your code respectively. Navigate to the detailed checklist to know how to make a JavaScript application multilingual."
}
},{
"@type": "Question",
"name": "What is i18n (internationalization)?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Software products are primarily prepared for your main-market and -language. During the internationalization of a software product new market targets will be added. Adjusting your software to handle this new markets with languages, locales and regions is called i18n process. Learn more about internationalization and what is used for in our complete guide with the title 'what is i18n'."
}
},{
"@type": "Question",
"name": "How can I have multiple languages on my website?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Decide which JavaScript framework to use. Then install the i18next npm-package and next add the 'i18next.init' code to your application. Follow the JavaScript example to take your first steps with i18next. Or just read our article about website localization."
}
}]
}
</script>
</div>
<footer i18next-options="{"ns": "common"}">
<div class="container">
<div class="row">
<div class="col-md-4"><img src="/img/locize_color.svg" style="max-width: 120px; margin-left: -5px;" alt="locize logo" loading="lazy">
<p><a href="https://tg.chregister.ch/cr-portal/auszug/auszug.xhtml?uid=CHE-412.131.272" target="_blank" style="color: #ffffff4d;" rel="nofollow">inweso GmbH</a></p>
<p>Switzerland<span style="color: white; font-size: 20px; position: relative; top: 3px; left: 5px;">🇨🇭</span></p>
<ul class="list-unstyled">
<li><a href="mailto:support@locize.com">support@locize.com</a></li>
</ul>
</div>
<div class="col-md-4">
<ul class="list-unstyled">
<li><a href="https://docs.locize.com">Technical Documentation</a></li>
<li><a href="https://docs.locize.com/integration/api">API</a></li>
<li><a href="/services.html">Services</a></li>
<li><a href="/pricing.html">Pricing</a></li>
<li><a href="/blog/">Blog</a></li>
</ul>
</div>
<div class="col-md-4">
<ul class="list-unstyled">
<li>
<ul class="list-inline list-social">
<li class="social-twitter"><a href="https://x.com/locize" target="_blank"><i class="fa-brands fa-x-twitter"></i></a></li>
<li class="social-facebook"><a href="https://www.facebook.com/locize" target="_blank"><i class="fa-brands fa-facebook"></i></a></li>
<li class="social-youtube"><a href="https://www.youtube.com/channel/UCPYQjBbbXojUcB8qjeIB3uA" target="_blank"><i class="fa-brands fa-youtube"></i></a></li>
</ul>
</li>
<li><a href="/privacy.html">Privacy</a></li>
<li><a href="/terms.html">Terms</a></li>
<li><a href="/security.html">Security</a></li>
</ul>
</div>
</div>
<div class="text-center footer-copyright">
<p><span class="translated">© 2024 </span><span>inweso GmbH. All Rights Reserved.</span></p>
</div>
</div>
</footer>
<div class="modalify-modal" id="modalify-modal">
<div class="modal-header">
<button class="close modalify-close" type="button" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
</div><img class="modal-content" id="img-in-modal" loading="lazy">
<div id="caption-in-modal"></div>
</div>
<script>window.bindAffix = false;</script>
<script src="/lib/jquery/jquery.min.js"></script>
<script src="/lib/bootstrap/js/bootstrap.min.js"></script>
<script src="//cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="/js/main.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var modal = document.getElementById("modalify-modal");
// Get the image and insert it inside the modal - use its "alt" text as a caption
var imgs = document.getElementsByClassName("modalify");
var modalImg = document.getElementById("img-in-modal");
var captionText = document.getElementById("caption-in-modal");
for (var i = 0; i < imgs.length; i++) {
var img = imgs[i];
img.onclick = function(){
modal.style.display = "block";
modalImg.src = this.getAttribute('full');
if (this.alt) captionText.innerHTML = this.alt;
}
}
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("modalify-close")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
};
modal.onclick = function() {
modal.style.display = "none";
};
});
</script>
<script src="//cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" data-cfasync="false"></script>
<script>
function enableCookies() {
var e = document.createElement("script");
e.type = "text/javascript";
e.async = true;
e.src = "https://www.googletagmanager.com/gtag/js?id=G-X50E21BGKG";
var a = document.getElementsByTagName("script")[0];
a.parentNode.insertBefore(e, a);
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-X50E21BGKG', { 'anonymize_ip': true });
//- gtag('config', 'UA-78143856-1', { 'anonymize_ip': true });
if (typeof window.enableCookiesHook === 'function') window.enableCookiesHook();
}
function disableCookies() {
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
}
if (typeof window.disableCookiesHook === 'function') window.disableCookiesHook();
}
window.cookieconsent.initialise({
palette: {
popup: {
background: "#2196f3",
text: "#ffffff"
},
button: {
background: "#1976d2",
text: "#ffffff"
}
},
theme: "edgeless",
type: "opt-in",
content: {
message: "This website uses cookies to ensure you get the best experience on our website.",
allow: "Accept",
dismiss: "Decline",
link: "learn",
href: "https://locize.com/privacy.html"
},
elements: {
deny: '<a style="font-weight: 100; color: #ffffffa8; font-size: smaller;" aria-label="deny cookies" role="button" tabindex="0" class="cc-btn cc-deny">Decline</a>'
},
onInitialise: function (status) {
var type = this.options.type;
var didConsent = this.hasConsented();
if (type == 'opt-in' && didConsent) {
// enable cookies
enableCookies();
}
if (type == 'opt-out' && !didConsent) {
// disable cookies
disableCookies();
}
},
onStatusChange: function(status, chosenBefore) {
var type = this.options.type;
var didConsent = this.hasConsented();
if (type == 'opt-in' && didConsent) {
// enable cookies
enableCookies();
}
if (type == 'opt-out' && !didConsent) {
// disable cookies
disableCookies();
}
},
onRevokeChoice: function() {
var type = this.options.type;
if (type == 'opt-in') {
// disable cookies
disableCookies();
}
if (type == 'opt-out') {
// enable cookies
enableCookies();
}
}
});
</script>
</body>
</html>