Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: string translation for PHP and JS #392

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .babelrc.json

This file was deleted.

7 changes: 3 additions & 4 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Browsers that we support

last 1 version
> 1%
maintained node versions
not dead
last 4 Chrome versions
last 4 Safari versions
last 4 Firefox versions
9 changes: 5 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"indent": ["error", "tab", { "SwitchCase": 1 }],
"linebreak-style": [
"error",
"unix"
Expand All @@ -23,7 +21,7 @@
"always"
],
"no-unused-vars": [
"error", {
"warn", {
"vars": "all",
"args": "after-used",
"ignoreRestSiblings": false
Expand All @@ -32,7 +30,10 @@
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"no-alert": 0,
"no-nested-ternary": 0
"no-nested-ternary": 0,
"prettier/prettier": "off",
"no-shadow": "warn",
"camelcase": "warn"
},
"ignorePatterns": ["**/vendor/**"]
}
27 changes: 3 additions & 24 deletions .github/workflows/build-dev-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
pull_request:
types: [opened, synchronize, ready_for_review]
branches-ignore:
- 'update_dependencies'
- "update_dependencies"
jobs:
dev-zip:
name: Build ZIP and upload to s3
Expand All @@ -19,32 +19,11 @@ jobs:
git-sha-8: ${{ steps.retrieve-git-sha-8.outputs.sha8 }}
steps:
- name: Check out source files
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/gallium # 16.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Configure Composer cache
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
node-version: lts/hydrogen # 18.x
- name: Install composer deps
run: composer install --no-dev --prefer-dist --no-progress --no-suggest
- name: Install yarn deps
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/gallium # 16.x
node-version: lts/hydrogen # 18.x
- name: Build
run: |
yarn install --frozen-lockfile
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@ jobs:
name: E2E Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/gallium # 16.x
node-version: lts/hydrogen # 18.x
- name: Build
run: |
yarn install --frozen-lockfile
composer install --no-dev --prefer-dist --no-progress --no-suggest
yarn run build
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install testing env
run: bash ./bin/e2e-env.sh
- name: Run Cypress tests
Expand Down
39 changes: 8 additions & 31 deletions .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: PHP Tests
on:
push:
branches-ignore:
- 'master'
- "master"
# Cancel previous workflow run groups that have not completed.
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
Expand All @@ -16,30 +16,19 @@ jobs:
- name: Setup PHP version
uses: shivammathur/setup-php@v1
with:
php-version: '7.4'
php-version: "7.4"
extensions: simplexml
tools: composer:v2.1
- name: Checkout source code
uses: actions/checkout@v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Setup Composer cache
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
uses: actions/checkout@v4
- name: Install composer
run: composer install --prefer-dist --no-progress --no-suggest
- name: Run PHPCS
run: composer run lint

phpunit:
name: PHPUnit
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
services:
mysql:
image: mysql:5.7
Expand All @@ -52,25 +41,14 @@ jobs:
- name: Setup PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: "7.4"
extensions: simplexml, mysql
tools: phpunit-polyfills
- name: Checkout source code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install WordPress Test Suite
run: |
bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:${{ job.services.mysql.ports['3306'] }}
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Setup Composer cache
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install composer
run: composer install --prefer-dist --no-progress --no-suggest --no-dev
- name: Run phpunit
Expand All @@ -84,10 +62,10 @@ jobs:
- name: Setup PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: "7.4"
extensions: simplexml, mysql
- name: Checkout source code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Get Composer Cache Directory
id: composer-cache
run: |
Expand All @@ -103,4 +81,3 @@ jobs:
run: composer install --prefer-dist --no-progress --no-suggest
- name: PHPStan Static Analysis
run: composer phpstan

58 changes: 58 additions & 0 deletions .github/workflows/update-translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Dispatch Update to translations.themeisle.com

on:
push:
tags:
- "*"

jobs:
makepot:
name: Build, make pot file and upload to S3
runs-on: ubuntu-latest

steps:
- name: Check out source files
uses: actions/checkout@v4
- name: Setup node 16
uses: actions/setup-node@v4
with:
node-version: 16.x
- name: Install composer deps
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
composer install --no-dev --prefer-dist --no-progress
- name: Install yarn deps
run: yarn install --frozen-lockfile
- name: Build files
run: yarn run build
- name: Remove README.md from languages folder
run: rm -f languages/README.md
- name: Upload Latest Version to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_DEV_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.S3_AWS_KEY_ARTIFACTS }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_AWS_SECRET_ARTIFACTS }}
SOURCE_DIR: languages/
DEST_DIR: ${{ github.event.repository.name }}-translations/

dispatch-workflow:
runs-on: ubuntu-latest
needs: makepot

steps:
- name: Dispatch workflow
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.BOT_TOKEN }}
repository: Codeinwp/themeisle-translations
event-type: update-potfile
client-payload: |
{
"ref": "${{ github.ref }}",
"potfile": "https://verti-artifacts.s3.amazonaws.com/${{ github.event.repository.name }}-translations/templates-patterns-collection.pot",
"slug": "templates-patterns-collection"
}
16 changes: 8 additions & 8 deletions beaver/src/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ const Header = ( { closeModal, getOrder, getSearchQuery } ) => {
window.tiTpc.postType
) &&
parseInt( window.tiTpc.tier ) === 3 && (
<Button
label={ window.tiTpc.library.actions.save }
icon={ cloudUpload }
onClick={ () =>
updateCurrentTab( 'export' )
}
/>
) }
<Button
label={ window.tiTpc.library.actions.save }
icon={ cloudUpload }
onClick={ () =>
updateCurrentTab( 'export' )
}
/>
) }
</ButtonGroup>
) }

Expand Down
4 changes: 2 additions & 2 deletions beaver/src/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ if ( parseInt( window.tiTpc.tier ) === 3 ) {
const text = contextMenu.textContent;
contextMenu.textContent = text.replace(
// eslint-disable-next-line prettier/prettier
'<li><a class=\"fl-block-row-reset\" href=\"javascript:void(0);\">Reset Row Width</a></li>',
'<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li>',
// eslint-disable-next-line prettier/prettier
'<li><a class=\"fl-block-row-reset\" href=\"javascript:void(0);\">Reset Row Width</a></li><li><a class=\"fl-block-row-tpc-export\" onclick="window.tiTpc.tpcExport(this)" href=\"javascript:void(0);\">Save to Templates Cloud</a></li>'
'<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li><li><a class="fl-block-row-tpc-export" onclick="window.tiTpc.tpcExport(this)" href="javascript:void(0);">Save to Templates Cloud</a></li>'
);
}

Expand Down
9 changes: 1 addition & 8 deletions e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,5 @@
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"visual:test": "percy exec -- cypress run --config baseUrl=https://qa-neve.themeisle.com,video=false --spec 'cypress/integration/visual-regression/**/*.spec.js' --headless"
},
"browserslist": [
"> 0.5%",
"last 2 versions",
"Firefox ESR",
"not dead",
"not IE 9-11"
]
}
}
5 changes: 2 additions & 3 deletions editor/src/components/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ const Content = ( {
};

export default withSelect( ( select ) => {
const { isPreview, isFetching, getCurrentTab } = select(
'tpc/block-editor'
);
const { isPreview, isFetching, getCurrentTab } =
select( 'tpc/block-editor' );
return {
isPreview: isPreview(),
isFetching: isFetching(),
Expand Down
8 changes: 6 additions & 2 deletions editor/src/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,17 @@ const Header = ( { closeModal, getOrder, getSearchQuery } ) => {
await fetchTemplates( {
search: getSearchQuery(),
...order,
showFSE: tiTpc.isFSETheme ? window?.localStorage?.tpcShowFse === 'true' : false,
showFSE: tiTpc.isFSETheme
? window?.localStorage?.tpcShowFse === 'true'
: false,
} );

await fetchLibrary( {
search: getSearchQuery(),
...order,
showFSE: tiTpc.isFSETheme ? window?.localStorage?.tpcShowFse === 'true' : false,
showFSE: tiTpc.isFSETheme
? window?.localStorage?.tpcShowFse === 'true'
: false,
} );

setFetching( false );
Expand Down
15 changes: 5 additions & 10 deletions editor/src/components/import-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { importTemplate } from '../data/templates-cloud';
const ImportModal = ( {
clientId,
autoLoad = true,
isFse = false,
isFse = false,
modalOpen,
setModalOpen,
} ) => {
Expand All @@ -25,12 +25,8 @@ const ImportModal = ( {
previewData: select( 'tpc/block-editor' ).getPreview(),
} ) );

const {
removeBlock,
replaceBlocks,
insertBlocks,
resetBlocks,
} = useDispatch( 'core/block-editor' );
const { removeBlock, replaceBlocks, insertBlocks, resetBlocks } =
useDispatch( 'core/block-editor' );

const { togglePreview } = useDispatch( 'tpc/block-editor' );

Expand All @@ -44,9 +40,8 @@ const ImportModal = ( {

const { editPost } = useDispatch( 'core/editor' );

const { updateLibrary, updateTemplates } = useDispatch(
'tpc/block-editor'
);
const { updateLibrary, updateTemplates } =
useDispatch( 'tpc/block-editor' );

const [ importing, setImporting ] = useState( false );

Expand Down
Loading
Loading