Skip to content
This repository was archived by the owner on May 4, 2020. It is now read-only.

Commit f0f3433

Browse files
committed
fix: add back website
1 parent bc4a537 commit f0f3433

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+20347
-5
lines changed

.gitmodules

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,3 @@
22
path = test262
33
url = https://github.com/tc39/test262.git
44
shallow = true
5-
[submodule "formatjs.github.io"]
6-
path = formatjs.github.io
7-
url = [email protected]:formatjs/formatjs.github.io.git
8-
shallow = true

formatjs.github.io

Lines changed: 0 additions & 1 deletion
This file was deleted.

website/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.docusaurus
2+
build

website/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Website
2+
3+
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ yarn
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ yarn start
15+
```
16+
17+
This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```
22+
$ yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
```
30+
$ GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
31+
```
32+
33+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
id: basic-internationalization-principles
3+
title: Basic Internationalization Principles
4+
---
5+
6+
## What Is Internationalization and Why Does It Matter?
7+
8+
Internationalized software supports the languages and cultural customs of people throughout the world. The Web reaches all parts of the world. Internationalized web apps provide a great user experience for people everywhere.
9+
10+
Localized software adapts to a specific language and culture by translating text into the user's language and formatting data in accordance with the user's expectations. An app is typically localized for a small set of locales.
11+
12+
The [ECMA-402 JavaScript internationalization specification](https://github.com/tc39/ecma402) has an excellent overview.
13+
14+
## Locales: Language and Region
15+
16+
A "locale" refers to the lingual and cultural expectations for a region. It is represented using a "locale code" defined in [UTS LDML](https://www.unicode.org/reports/tr35/tr35.html#Identifiers).
17+
18+
This code is comprised of several parts separated by hyphens (-). The first part is a short string representing the language. The second, optional, part is a short string representing the region. Additionally, various extensions and variants can be specified.
19+
20+
Typically, web apps are localized to just the language or language-region combination. Examples of such locale codes are:
21+
22+
- `en` for English
23+
- `en-US` for English as spoken in the United States
24+
- `en-GB` for English as spoken in the United Kingdom
25+
- `es-AR` for Spanish as spoken in Argentina
26+
- `ar-001` for Arabic as spoken throughout the world
27+
- `ar-AE` for Arabic as spoken in United Arab Emirates
28+
29+
Most internationalized apps only support a small list of locales.
30+
31+
## Translating Strings
32+
33+
You likely have some text in your application that is in a natural language such as English or Japanese. In order to support other locales, you will need to translate these strings.
34+
35+
FormatJS provides a mechanism to let you write the core "software" of your application without special code for different translations. The considerations for each locale are encapsulated in your translated strings and our libraries.
36+
37+
```tsx
38+
const messages = {
39+
en: {
40+
GREETING: 'Hello {name}',
41+
},
42+
fr: {
43+
GREETING: 'Bonjour {name}',
44+
},
45+
};
46+
```
47+
48+
We use the [ICU Message syntax](http://userguide.icu-project.org/formatparse/messages) which is also used in [Java](http://docs.oracle.com/javase/7/docs/api/java/text/MessageFormat.html), C, PHP and various other platforms.
49+
50+
## Bundling Translated Strings
51+
52+
It is common to organize your translations primarily by locale, because you only need the translations for the user's current locale. Our template and component library integrations are designed to work with the translations for a single locale. If your app is complex, you can further subdivide your translations, such as by page or section of the site.
53+
54+
## Structure of Code
55+
56+
The actual formatting and presentation of data and translated strings typically takes these steps:
57+
58+
1. Determine the user's locale, as described in Runtime Environments guide.
59+
2. Setup one of FormatJS's integrations with the following data:
60+
- the user's current locale
61+
- translated strings for that locale
62+
- optionally, any custom formats
63+
3. Call the template engine, passing the data that needs formatting.

0 commit comments

Comments
 (0)