Skip to content

Commit

Permalink
Merge pull request #632 from zyf722/i18next-integration-draft
Browse files Browse the repository at this point in the history
  • Loading branch information
hatemhosny authored Oct 1, 2024
2 parents 4a1eab6 + a3865da commit faacc80
Show file tree
Hide file tree
Showing 194 changed files with 12,818 additions and 1,441 deletions.
4 changes: 4 additions & 0 deletions .bundlewatch.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ module.exports = {
path: './build/livecodes/*.css',
maxSize: '15kB',
},
{
path: './build/livecodes/i18n-*.json',
maxSize: '10kB',
},
],
defaultCompression: 'brotli',
normalizeFilenames: /^.+?((\.[^.]{8,}}?)|())\.\w+$/,
Expand Down
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/i18n_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: 🌐 I18n Request
description: Request for internationalization support for a specific language
title: 'I18n: '
labels: [👀 needs triage, 🌐 I18n]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this i18n request!
- type: markdown
attributes:
value: |
Before submitting your request, please check out [our Lokalise project page](https://app.lokalise.com/public/34958094667a72e9454592.95108106/) to see if the language you are requesting is already supported or being currently worked on.
- type: input
attributes:
label: Requested language
description: The UI language you would like to request support for.
validations:
required: true
- type: textarea
attributes:
label: Supporting details
description: We want to hear why you think this language should be supported (e.g. user base, translation help, etc.). Please provide details regarding your request.
- type: textarea
id: context
attributes:
label: Additional context
description: Add any other context about the problem or helpful links here.
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/live-codes/livecodes/blob/HEAD/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
- type: checkboxes
id: contribution
attributes:
label: Contributing Docs
description: If you plan on contributing i18n please read - [Contribution Guide](https://github.com/live-codes/livecodes/blob/HEAD/CONTRIBUTING.md) and [I18n Guide](https://github.com/live-codes/livecodes/blob/HEAD/docs/docs/contribution/i18n.md)
options:
- label: I agree to follow this project's Contribution Docs
required: false
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- ✅ Provide tests for your changes.
- 📝 Use descriptive commit messages.
- 📗 Update any related documentation and include any relevant screenshots.
- 🌐 Use `window.deps.translateString` in .ts files and add `data-i18n` attributes in .html files to mark strings that needs to be translated.
-->

## What type of PR is this? (check all applicable)
Expand All @@ -27,6 +28,7 @@
- [ ] 🔁 CI
- [ ] 📦 Chore (Release)
- [ ] ⏩ Revert
- [ ] 🌐 Internationalization / Translation

## Description

Expand Down
23 changes: 21 additions & 2 deletions .github/workflows/CI-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,34 @@ jobs:
NODE_OPTIONS: '--max_old_space_size=4096'
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

# - name: Cache Node modules
# id: cache-npm
# uses: actions/cache@v4
# with:
# path: ~/.npm
# key: ${{ runner.os }}-build-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-build-${{ matrix.node-version }}-
# ${{ runner.os }}-build-
# ${{ runner.os }}-

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build
env:
BUILD_INCLUDE_LOCALES: ${{ startsWith(github.head_ref, 'i18n/') }}

- name: Test
run: npm run test
env:
Expand Down
98 changes: 22 additions & 76 deletions .github/workflows/CI-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,102 +3,48 @@ name: CI-e2e
on: [pull_request]

jobs:
test1:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [18.x]
test: [1, 2, 3, 4]
env:
NODE_OPTIONS: '--max_old_space_size=4096'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Test 1
run: npm run ci:e2e
env:
CI: true
CI_SHARD_INDEX: 1
CI_SHARD_TOTAL: 4
uses: actions/checkout@v4

test2:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
env:
NODE_OPTIONS: '--max_old_space_size=4096'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Test 2
run: npm run ci:e2e
env:
CI: true
CI_SHARD_INDEX: 2
CI_SHARD_TOTAL: 4
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

# - name: Cache Node modules
# id: cache-npm
# uses: actions/cache@v4
# with:
# path: ~/.npm
# key: ${{ runner.os }}-build-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-build-${{ matrix.node-version }}-
# ${{ runner.os }}-build-
# ${{ runner.os }}-

test3:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
env:
NODE_OPTIONS: '--max_old_space_size=4096'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci

- name: Build
run: npm run build
- name: Test 3
run: npm run ci:e2e
env:
CI: true
CI_SHARD_INDEX: 3
CI_SHARD_TOTAL: 4
BUILD_INCLUDE_LOCALES: ${{ startsWith(github.head_ref, 'i18n/') }}

test4:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
env:
NODE_OPTIONS: '--max_old_space_size=4096'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Test 4
- name: Test ${{ matrix.test }}
run: npm run ci:e2e
env:
CI: true
CI_SHARD_INDEX: 4
CI_SHARD_INDEX: ${{ matrix.test }}
CI_SHARD_TOTAL: 4
22 changes: 19 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,37 @@ on:
branches:
- main

env:
NODE_VERSION: 18.x

jobs:
deploy:
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_ACTIONS_REPO_PAT }}

- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

# - name: Cache Node modules
# id: cache-npm
# uses: actions/cache@v4
# with:
# path: ~/.npm
# key: ${{ runner.os }}-build-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-build-${{ env.NODE_VERSION }}-
# ${{ runner.os }}-build-
# ${{ runner.os }}-

- name: Install dependencies
run: npm ci
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/i18n-update-notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: i18n-update-notify

on:
pull_request:
branches: [develop]
types: [closed]
paths: ['src/livecodes/i18n/locales/**']

jobs:
notify:
name: Notify
runs-on: ubuntu-latest
if: github.event.pull_request.merged && github.event.sender.login != 'github-actions[bot]' && !startsWith(github.head_ref, 'i18n/')
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Create comment on PR
uses: actions/github-script@v6
with:
script: |
const commentBody = `## i18n Actions
Source PR has been merged into the default branch.
Maintainers can comment \`.i18n-update-push\` to trigger the i18n update workflow and push the changes to Lokalise.
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
})
Loading

0 comments on commit faacc80

Please sign in to comment.