Skip to content

Commit 755cdfa

Browse files
authored
cleanup: finish removing gulp (#163)
While there, sync README.md instructions with recent changes.
1 parent a97cf13 commit 755cdfa

File tree

3 files changed

+20
-85
lines changed

3 files changed

+20
-85
lines changed

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@
1313
>
1414
> We expect all contributions to reflect a genuine understanding of the code being changed. PRs that appear to be generated by AI tools without meaningful human review will be closed.
1515
16-
`mlab-speedtest` is an Angular.js application providing the website https://speed.measurementlab.net. The app code currently uses `gulp` to integrate language localizations prior to deployment.
16+
The `mlab-speedtest` repository implements the https://speed.measurementlab.net/ website.
1717

1818
## Setting up Local Development Environment
1919

2020
### Install Build Dependencies
2121

2222
* Install website build dependencies for your operating system and environment
23-
* Node >= v10.15.1 - Using NVM: `nvm install v10.15.1`
24-
* Gulp - Installed with `yarn`
25-
* Install libraries - `gulp copy_libs`
23+
* Node >= v20.0 - Using NVM: `nvm install v20.0`
24+
* Install libraries - `npm install`
25+
* Build dist - `npm run build`
26+
* Serving locally - `python3 -m http.server -d dist`
2627
* Firebase tools - `npm install -g firebase-tools`
2728

2829
## Adding new languages
@@ -31,25 +32,24 @@ Translations for this site are managed in the [Open Technology Fund's Localizati
3132

3233
### How to add a new localization
3334

34-
* Download a completed language translation file
35-
* Visit the Transifex site and locate a completed language
36-
* Click **Interface Language Strings** and then **Download for use** to download the completed language `.po` file
37-
* Save it in the folder: `/translations/source/` using the file name pattern: **<two letter langugage code>.po**
38-
* Create new language template & update language string references
39-
* Create a copy of an existing translation folder and index.html file, and make some edits to support the new language
40-
* Copy the folder and index file: `cp -r app/nl app/es`
41-
* Edit the index file to change the language it references. In `app/es/index.html`:
42-
* change: `const INTERFACE_LANGUAGE = 'nl';` to `const INTERFACE_LANGUAGE = 'es';`
43-
* change: `<script src="/assets/translations/it.js"></script>`
44-
* to: `<script src="/assets/translations/es.js"></script>`
45-
* Regenerate the supported language strings:
46-
* `gulp inject`
35+
1. Download the completed `.po` file from Transifex and save it in `translations/languages/`
36+
* Use the existing naming convention (e.g., `es.po`, `de_DE.po`)
37+
2. If the filename uses a locale code (e.g., `de_DE`), add a mapping in `scripts/po-to-json.js` so it maps to the short code (e.g., `de_DE` -> `de`)
38+
3. Add the short language code to the `supported` array in `src/js/i18n.js`
39+
* If the language is RTL, also add it to the `rtlLanguages` array
40+
4. Rebuild: `npm run build`
41+
42+
The build converts `.po` files to JSON in `dist/translations/`. At runtime, `i18n.js` selects the language automatically via the `?lang=` query parameter, `localStorage`, or browser preference.
4743

4844
## Previewing site locally
4945

50-
To preview the site locally, we recommend using the Python Simple HTTP Server.
46+
To preview the site locally, we recommend using Python:
5147

52-
* Navigate to the `/app` directory and run: `python3 -m http.server 8000`
48+
```
49+
npm install
50+
npm run build
51+
python3 -m http.server -d dist
52+
```
5353

5454
If you are a user on the M-Lab Firebase project, you can also preview the site locally using the firebase-cli: `firebase serve --only hosting:mlab-speedtest`
5555

gulpfile.js

Lines changed: 0 additions & 65 deletions
This file was deleted.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)