By Manvel Saroyan
12/11/2018 Ամսաթիվը
const date = new Date(2018, 10, 12);
console.log(new Intl.DateTimeFormat('en-GB').format(date));
console.log(new Intl.DateTimeFormat('en-US').format(date));
console.log(new Intl.DateTimeFormat('lt-LT').format(date));
console.log(new Intl.DateTimeFormat('hy-AM').format(date));
12/11/2018
11/12/2018
2018-11-12
12.11.2018
1234567.89 թիվը
const number = 1234567.89;
console.log(new Intl.NumberFormat('en-US').format(number));
console.log(new Intl.NumberFormat('fr-FR').format(number));
console.log(new Intl.NumberFormat('de-CH').format(number));
console.log(new Intl.NumberFormat('es-ES').format(number));
en-US: 1,234,567.89
fr-FR: 1 234 567,89
de-CH: 1’234’567.89
es-ES: 1.234.567,89
const items = ["Bob", "Nika", "Yves"];
console.log(items.sort((a, b) => a.localeCompare(b)));
console.log(items.sort((a, b) => a.localeCompare(b, 'lt')));
Հայտարարում է փաստաթղթի կանխադրված լեզուն
<html lang="de"></html>
<a href="/de/documentation" hreflang="de">Dokumentation</a>
<a href="/en/address" hreflang="en">Address</a>
a[hreflang]:after
{
content: "["attr(hreflang)"]";
color: #999;
vertical-align: super;
font-size: 50%;
}
Accept-Language : en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7,
hy-AM;q=0.6,hy;q=0.5
console.log(navigator.languages); // ["en-US", "ru", "es"]
q
- լեզվի կարեւորությունը
<img src="/images/puma.svg" alt="Šokinėja puma" />
<html dir="rtl"></html>
.vert { writing-mode: vertical-lr; }
<html>
<html dir="rtl" lang="ar">
.hamburger
{
position: absolute;
right: 10px;
top: 10px;
}
.hamburger
{
position: absolute;
right: 10px;
top: 10px;
}
[dir="rtl"] .hamburger
{
left: 10px;
right: 0;
}
header
{
display: flex;
}
#menu-items
{
list-style: none;
display: flex;
flex-grow: 1;
}
button
{
width: 120px;
}
button
{
/* width: 120px; */
padding: 0 10px;
}
.message-next-to-button
{
margin-right: 100px;
}
.message-next-to-button
{
/* Use with precaution */
margin-inline-end: 100px;
-webkit-margin-end: 100px;
}
html:not([dir="rtl"]) .message-next-to-button
{
margin-right: 100px;
}
html([dir="rtl"]) .message-next-to-button
{
margin-left: 100px;
}
Թիրախային լեզվի համապատասխանություն
Շրջանցիկ նկատառում
Օգտագործել յունիքոդի միջակայքը
350kb woff2
1.1mb ttf
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 300;
src: local('Source Sans Pro'), url("300/cyrillic.woff2") format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
# https://github.com/fonttools/fonttools
pyftsubset DejaVuSans-ExtraLight.ttf --unicodes=U+0530-058F --flavor=woff2 --output-file=armenian.woff2
https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese
<head>
<title>Surfez sans désagrément</title>
<meta name="description" content="Adblock Plus est le bloqueur de publicités le plus populaire">
</head>
<html lang="de">
<head>
<link rel="alternate" href="http://www.example.com/en" hreflang="en">
<link rel="alternate" href="http://www.example.com/es" hreflang="es">
...
<head>
JSON
XML
.po, .pot
String ID
Description
Message/Text
/* /en/menu/header.json */
{
"menu-item-about": {
"description": "Menu item label located in the header",
"message": "About us"
}
}
/* /ru/menu/header.json */
{
"menu-item-about": {
"description": "Menu item label located in the header",
"message": "О нас"
}
}
Հղղել թարգմանության ֆայլին
Հղղել թարգմանության տողի ID-ին(StringID)
getText("stringId", "filePath")
{stringId(filePath)}
-
{menu-item-about(menu/header)}
-
About us
-
О нас
-
Մեր մասին
I love you
{
"like-button-title": {
"message": "je t' aime "
}
}
{
"like-button-title": {
"message": "eu te amo "
}
}
{
"like-button-title": {
"message": "Ես քեզ սիրում եմ"
}
}
Ֆիքսված տերմիններ
Բրենդերի անուններ
Օգտատերերի անուններ(Usernames)
"whitelisted_notification": {
"message": "$domain$ was whitelisted",
"placeholders": {
"domain": {
"content": "$1",
"example": "www.example.com"
}
}
}
getMessage("whitelisted_notification", ["www.example.com"]);
www.example.com was whitelisted
{fixed-id <fix>CMintS</fix> uses <fix>fix</fix> tag}
"fixed-id": {
"message": "<fix2> тэг используется <fix1>-ом"
}
fix тэг используется CMintS-ом
locales
├── de
│ ├── about.json
│ └── header.json
├── en
│ ├── about.json
│ └── header.json
└── ru
├── about.json
└── header.json
theme
├── layouts
│ ├── default.ejs
│ └── home.ejs
└── less/sass
├── _header.less
├── index.less
└── main.less
pages
├── about
│ └── team.md
├── about.md
├── index.ejs
└── news.md
Առանձին էջ լեզվի համար
// From Hexo website
/en/index.html
/zh-tw/index.html
// From Hugo website
/content/about.md
/content/about.fr.md
## Translation strings
The translation strings can be defined in the source files by placing them
inside of opening and closing curly braces. Translation string consist of
stringId, optional description and source text:
## Heading IDs in markdown
Markdown headers are automatically getting ID set to them, for the future
reference and TOC generation, whenever a translation string is used as a
markdown heading element text translation StringID is used as a header ID.
{StringId[Description] Message}
## {translation-strings[Page heading] Translation strings}
{translation-strings-p[Paragraph in 'Translation strings' section]
The translation strings can be defined in the source files by placing them
inside of opening and closing curly braces. Translation string consist of
stringId, optional description and source text:
}
## {markdown-heading-id[Page heading] Heading IDs in markdown}
{markdown-heading-id-p[Paragraph in 'Heading IDs in markdown' section]
Markdown headers are automatically getting ID set to them, for the future
reference and TOC generation, whenever a translation string is used as a
markdown heading element text translation StringID is used as a header ID.
}