Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit 6cdaece

Browse files
authored
Merge pull request #4 from negar-binary/master
Update
2 parents b20603e + 42db8fb commit 6cdaece

195 files changed

Lines changed: 11471 additions & 7345 deletions

File tree

Some content is hidden

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

404.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
'de': 'de|at|li',
1414
'es': 'ar|bo|cl|co|cr|cu|do|ec|sv|gt|hn|mx|ni|pa|py|pr|es|uy|ve',
1515
'fr': 'fr|ad|bj|bf|cf|cg|ga|gn|ml|mc|ne|sn|tg',
16-
'id': 'id',
1716
'it': 'it',
1817
'ko': 'kr',
1918
'pl': 'po',

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Binary-Static
22
=============
33

4-
This repository contains the static HTML, Javascript, CSS, and images content of the [Binary.com](http://www.binary.me) website.
4+
This repository contains the static HTML, Javascript, CSS, and images content of the [Binary.me](http://www.binary.me) website.
55

66
## Installation
77

8-
In order to work on your own version of the Binary.com Javascript and CSS, please **fork this project**.
8+
In order to work on your own version of the Binary.me Javascript and CSS, please **fork this project**.
99

1010
You will also need to install the following on your development machine:
1111

index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
'de': 'de|at|li',
2626
'es': 'ar|bo|cl|co|cr|cu|do|ec|sv|gt|hn|mx|ni|pa|py|pr|es|uy|ve',
2727
'fr': 'fr|ad|bj|bf|cf|cg|ga|gn|ml|mc|ne|sn|tg',
28-
'id': 'id',
2928
'it': 'it',
3029
'ko': 'kr',
3130
'pl': 'po',
@@ -81,6 +80,9 @@
8180
}
8281
var lang = getCookieItem('language');
8382
if(lang) {
83+
if (/^id$/i.test(lang)) {
84+
lang = 'en';
85+
}
8486
isDelayedRedirect();
8587
} else {
8688
var ws = new WebSocket('wss://ws.binaryws.com/websockets/v3?app_id=1');

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "binary-static",
33
"version": "3.8.0",
4-
"description": "Binary.com static content",
4+
"description": "Binary.me static content",
55
"scripts": {
66
"test": "grunt test",
77
"livereload": "sudo -p 'enter password for sudo:' grunt livereload",
@@ -16,13 +16,14 @@
1616
"binary",
1717
"static"
1818
],
19-
"author": "Binary.com",
19+
"author": "Binary.me",
2020
"license": "Apache License 2.0",
2121
"bugs": {
2222
"url": "https://github.com/binary-com/binary-static/issues"
2323
},
2424
"homepage": "https://github.com/binary-com/binary-static",
2525
"devDependencies": {
26+
"@babel/parser": "7.1.2",
2627
"app-root-path": "2.0.1",
2728
"autoprefixer": "7.2.3",
2829
"babel-core": "6.26.0",
@@ -45,11 +46,13 @@
4546
"connect-livereload": "0.6.0",
4647
"connect-modrewrite": "0.9.0",
4748
"deep-diff": "0.3.8",
49+
"emphasize": "2.0.0",
4850
"eslint-config-airbnb-base": "13.1.0",
4951
"eslint-config-binary": "1.0.2",
5052
"eslint-config-prettier": "2.9.0",
5153
"eslint-plugin-import": "2.14.0",
5254
"eslint-plugin-react": "7.11.1",
55+
"estraverse": "4.2.0",
5356
"extend": "3.0.1",
5457
"gettext-parser": "1.3.0",
5558
"grunt": "1.0.1",

robots.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
User-agent: *
2-
Sitemap: https://www.binary.com/sitemap.xml
2+
Sitemap: https://www.binary.me/sitemap.xml

scripts/README.md

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
## Update translations
1+
## Updating the Translations
22

3-
#### Setup
3+
### Initial setup:
44
* Please make sure you have done `npm install`.
55
* Install `Homebrew` by `ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
66
* Install `Crowdin CLI` by `brew install crowdin` or follow the instructions here: [https://support.crowdin.com/cli-tool/#installation](https://support.crowdin.com/cli-tool/#installation)
77
* Get [Crowdin API Key](https://crowdin.com/project/binary-static/settings#api) and add this line to your _.bash_profile_: `export CROWDIN_API_KEY='put API Key here'`<br/>
88
**IMPORTANT!** This key gives full access to all your Crowdin project data. Treat this just like a password and never push it to any public repo.
99

10-
#### Update translations
10+
### To update the translations:
1111
* Simply run `./scripts/update_translations.sh` in root folder of project to do these tasks:<br/>
1212
(It is possible to confirm/skip each task by answering y/n to questions, only first one is mandatory):
1313
* Check out and update the translations branch
@@ -17,7 +17,37 @@
1717
* Commit changes and push to origin
1818
* Open github to submit the PR
1919

20-
## Update sitemap
20+
### Extracting texts from js code:
21+
Texts that are used in js code will automatically be extracted during the translation update process (3rd step above: Updating the source file).
2122

22-
* List of paths to include in `sitemap.xml` is here: [sitemap.js](sitemap.js)
23+
In order to make sure that no strings are missed by the extractor code while pushing to translations, please:
24+
25+
1. Refactor the code so that the first argument passed to the `localize()` method is a string literal.
26+
i.e.
27+
```js
28+
const text = localize(is_started ? 'Sell at market' : 'Sell');
29+
```
30+
would change to:
31+
```js
32+
const text = is_started ? localize('Sell at market') : localize('Sell');
33+
```
34+
2. If there is no way to have the string literal in js code (i.e. API texts which are not translated), add them to `scripts/js_texts/static_strings_app.js`.
35+
36+
Note: Regarding API texts, even if the string is translated automatically somewhere else we should still include it here to avoid missing it if that other string gets removed.
37+
38+
3. At the end, when you're sure that a string has already been taken care of, just put this comment `/* localize-ignore */` right after the first argument of `localize()` call to ignore it from tests.
39+
40+
### `js_texts` folder contents:
41+
```
42+
js_texts:
43+
├── extracted_strings_app.js
44+
└── static_strings_app.js
45+
```
46+
- `extracted_strings_app.js`: Contains extracted strings. It's for debugging purpose only and shouldn't be changed manually.
47+
- `static_strings_app.js` to handle those strings that don't exist in js code. e.g. API texts that are not localised, etc.
48+
49+
During the translation update process, the source file `messages.pot` will be updated with all texts from both the above files.
50+
51+
## Updating the Sitemap
52+
* List of paths to include in `sitemap.xml` is here: [config/sitemap_urls.js](config/sitemap_urls.js)
2353
* Once the paths are updated in the above file, run `./scripts/sitemap.js` or `grunt shell:sitemap` to generate new `sitemap.xml`
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const color = require('cli-color');
2+
const expect = require('chai').expect;
3+
const extract = require('../extract_js_texts');
4+
5+
describe('extract_js_texts.js', () => {
6+
let errors_count = 0;
7+
8+
before(function (done) {
9+
this.timeout(60000);
10+
extract.parse('app', true);
11+
errors_count = extract.getErrorsCount();
12+
done();
13+
});
14+
15+
it('localize() calls should have the first arguments as literal string', () => {
16+
expect(errors_count).to.be.a('number').and.to.eq(0);
17+
});
18+
19+
after(() => {
20+
if (errors_count) {
21+
console.log(
22+
color.white('\tDescription:\n'),
23+
color.xterm(8)(
24+
`\tThis is to make sure that the extractor code won't miss any string to push to translations.
25+
\t1. Please check the errors and refactor the code accordingly.
26+
\t2. If there is no way to have the string literal in js code (i.e. API texts),
27+
\t add them to 'scripts/js_texts/static_strings_app.js'.
28+
\t3. At the end, when you're sure that a strings already been taken care of somewhere else,
29+
\t just put this comment /* localize-ignore */ right after the first argument of localize() call to ignore it.`
30+
)
31+
);
32+
}
33+
});
34+
});
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
const color = require('cli-color');
2-
const expect = require('chai').expect;
3-
const texts = require('../generate-static-data').texts;
1+
const color = require('cli-color');
2+
const expect = require('chai').expect;
3+
const texts_app = require('../js_texts/static_strings_app');
44

5-
describe('generate-static-data.js', () => {
5+
describe('scripts/js_texts/static_strings_app.js', () => {
66
const all = {};
77
const duplicates = {};
88

99
before(() => {
10-
texts.forEach((str) => {
10+
texts_app.forEach((str) => {
1111
if (all[str]) {
1212
duplicates[str] = (duplicates[str] || 1) + 1;
1313
} else {

scripts/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const util = require('util');
55

66
exports.root_path = require('app-root-path').path;
77

8-
exports.pages = require('./pages.js').map(p => ({
8+
exports.pages = require('./config/pages.js').map(p => ({
99
save_as : p[0],
1010
tpl_path : p[1],
1111
layout : p[2],
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,17 @@ module.exports = [
6767
// ==================== Section: "static" ====================
6868
['404', 'static/404', 'full_width', '404'],
6969
['home', 'static/home', 'full_width', 'Online Trading platform for binary options on Forex, Indices, Commodities and Smart Indices'],
70+
['keep-safe', 'static/keep_safe', 'full_width', 'Keep Safe'],
7071
['tour', 'static/tour', 'full_width', 'Tour'],
7172
['why-us', 'static/why_us', 'full_width', 'Why Us'],
7273
['platforms', 'static/platforms', 'full_width', 'Trading Platforms'],
7374

7475
['about-us', 'static/about/index', 'full_width', 'About Us'],
7576
['binary-in-numbers', 'static/about/binary_in_numbers', 'default', 'Binary in Numbers'],
7677
['careers', 'static/about/careers', 'full_width', 'Careers'],
78+
['careers/privacy-policy', 'static/about/job_applicant_policy', 'full_width', 'Job Applicant Privacy Policy'],
7779
['contact', 'static/about/contact', 'full_width', 'Contact Us'],
80+
['contact-2', 'static/about/contact_2', 'full_width', 'Contact Us'],
7881
['cyberjaya', 'static/about/cyberjaya', 'full_width', 'Careers - Cyberjaya', 'ja'],
7982
['labuan', 'static/about/labuan', 'full_width', 'Careers - Labuan', 'ja'],
8083
['malta', 'static/about/malta', 'full_width', 'Careers - Malta', 'ja'],
@@ -88,7 +91,7 @@ module.exports = [
8891
['ib-programme/ib-signup', 'static/ib_programme/ib_signup', 'full_width', 'IB programme'],
8992
['ib-programme/ib-faq', 'static/ib_programme/ib_faq', 'default', 'IB programme FAQ'],
9093
['legal/us_patents', 'static/legal/us_patents', 'default', 'US Patents'],
91-
['regulation', 'static/legal/regulation', 'default', 'Regulation', 'id'],
94+
['regulation', 'static/legal/regulation', 'default', 'Regulation'],
9295
['responsible-trading', 'static/responsible_trading', 'full_width', 'Responsible Trading'],
9396
['terms-and-conditions', 'static/legal/tac', 'default', 'Terms and Conditions'],
9497

0 commit comments

Comments
 (0)