Skip to content

Commit a0fef77

Browse files
authored
Merge pull request #1013 from Codeinwp/enh/translations-generic
Improvements & string adjustments
2 parents 5a02a7a + 188c9b8 commit a0fef77

File tree

15 files changed

+99
-52
lines changed

15 files changed

+99
-52
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Translations Diff
2+
3+
on:
4+
pull_request_review:
5+
pull_request:
6+
types: [opened, edited, synchronize, ready_for_review]
7+
branches:
8+
- development
9+
- master
10+
11+
jobs:
12+
translation:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Base Branch
16+
uses: actions/checkout@v4
17+
with:
18+
ref: ${{ github.base_ref }}
19+
path: optimole-base
20+
- name: Setup node 16
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 16.x
24+
- name: Build POT for Base Branch
25+
run: |
26+
cd optimole-base
27+
composer install --no-dev --prefer-dist --no-progress --no-suggest
28+
npm ci
29+
npm run build
30+
# TODO: when is merged to master, switch to npm run make-pot
31+
docker run --user root --rm --volume $(pwd):/var/www/html/optimole-wp wordpress:cli bash -c 'php -d memory_limit=512M $(which wp) --version --allow-root && wp i18n make-pot optimole-wp ./optimole-wp/languages/optimole-wp.pot --include=inc,assets/src --allow-root --domain=optimole-wp'
32+
ls languages/
33+
- name: Checkout PR Branch (Head)
34+
uses: actions/checkout@v4
35+
with:
36+
path: optimole-head
37+
- name: Build POT for PR Branch
38+
run: |
39+
cd optimole-head
40+
composer install --no-dev --prefer-dist --no-progress --no-suggest
41+
npm ci
42+
npm run build
43+
npm run make-pot
44+
ls languages/
45+
- name: Compare POT files
46+
uses: Codeinwp/action-i18n-string-reviewer@main
47+
with:
48+
fail-on-changes: 'true'
49+
openrouter-key: ${{ secrets.OPEN_ROUTER_API_KEY }}
50+
openrouter-model: 'google/gemini-2.5-flash'
51+
base-pot-file: 'optimole-base/languages/optimole-wp.pot'
52+
target-pot-file: 'optimole-head/languages/optimole-wp.pot'
53+
github-token: ${{ secrets.BOT_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ assets/build
1313
test-results
1414
tests/assets/filestash
1515
coverage
16+
languages

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ Fix edge cases for auto allowing domain on site migration.
998998

999999
**Documentation**
10001000

1001-
* improve readme description of the OptiMole service ([e020300](https://github.com/Codeinwp/optimole-wp/commit/e020300))
1001+
* improve readme description of the Optimole service ([e020300](https://github.com/Codeinwp/optimole-wp/commit/e020300))
10021002

10031003

10041004

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,12 @@ Discover how to make the most of Optimole with our detailed and user-friendly [d
262262

263263

264264
## Installation ##
265-
The following are the steps to install the OptiMole plugin
265+
The following are the steps to install the Optimole plugin
266266

267267
1. In your WordPress Administration Panels, click on Add New option under Plugins from the menu.
268268
Click on upload at the top.
269-
2. Browse the location and select the OptiMole Plugin and click install now.
270-
3. Go to Media -> OptiMole and follow in the instructions on how to enable the service.
269+
2. Browse the location and select the Optimole Plugin and click install now.
270+
3. Go to Media -> Optimole and follow in the instructions on how to enable the service.
271271

272272
## Frequently Asked Questions ##
273273

assets/src/dashboard/parts/connected/dashboard/LastImages.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const Image = ({
5555
} }
5656
ref={ squareRef }
5757
/>
58-
<p className="optml__bullet w-full h-4">{ getSize() }% { optimoleDashboardApp.strings.latest_images.saved } </p>
58+
<p className="optml__bullet w-full h-4">{ optimoleDashboardApp.strings.latest_images.percentage_saved.replace( '{ratio}', getSize() ) } </p>
5959
</div>
6060
);
6161
};
@@ -136,7 +136,7 @@ const LastImages = () => {
136136

137137
return (
138138
<div>
139-
<h3 className="text-gray-800 text-xl font-semibold mb-5 m-0">{ optimoleDashboardApp.strings.latest_images.last } { optimoleDashboardApp.strings.latest_images.optimized_images }</h3>
139+
<h3 className="text-gray-800 text-xl font-semibold mb-5 m-0">{ optimoleDashboardApp.strings.latest_images.last_optimized_images }</h3>
140140

141141
{ ( isInitialLoading && ! isLoaded ) && (
142142
<div className="flex items-center flex-col py-2">

assets/src/dashboard/parts/connected/settings/Compression.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ const Compression = ({
352352
{ ( sampleImages.id && 0 < sampleImages.original_size ) && (
353353
<div>
354354
{ 0 < getCompressionRatio() ? (
355-
<p className="text-base">{ 100 - getCompressionRatio() }% { optimoleDashboardApp.strings.latest_images.smaller }</p>
355+
<p className="text-base">{ optimoleDashboardApp.strings.latest_images.percentage_smaller.replace( '{ratio}', 100 - getCompressionRatio() ) }</p>
356356
) : (
357357
<p className="text-base">{ optimoleDashboardApp.strings.latest_images.same_size }</p>
358358
) }

assets/src/dashboard/utils/api.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export const connectAccount = ( data, callback = () => {}) => {
153153
sendOnboardingImages();
154154
toggleDashboardSidebarSubmenu( true );
155155

156-
console.log( '%c OptiMole API connection successful.', 'color: #59B278' );
156+
console.log( '%c Optimole API connection successful.', 'color: #59B278' );
157157

158158
} else {
159159
setHasValidKey( false );
@@ -195,7 +195,7 @@ export const disconnectAccount = () => {
195195
sethasDashboardLoaded( false );
196196
setShowDisconnect( false );
197197
toggleDashboardSidebarSubmenu( false );
198-
console.log( '%c Disconnected from OptiMole API.', 'color: #59B278' );
198+
console.log( '%c Disconnected from Optimole API.', 'color: #59B278' );
199199
} else {
200200
console.error( response );
201201
}
@@ -221,7 +221,7 @@ export const selectDomain = ( data, callback = () => {}) => {
221221
setAPIKey( response.data.api_key );
222222
setUserData( response.data );
223223
setAvailableApps( response.data );
224-
console.log( '%c OptiMole API connection successful.', 'color: #59B278' );
224+
console.log( '%c Optimole API connection successful.', 'color: #59B278' );
225225
} else {
226226
setHasValidKey( false );
227227
console.log( '%c Invalid API Key.', 'color: #E7602A' );
@@ -271,7 +271,7 @@ export const requestStatsUpdate = () => {
271271
if ( 'disconnected' === response.code ) {
272272
setIsConnected( false );
273273
sethasDashboardLoaded( false );
274-
console.log( '%c Disconnected from OptiMole API.', 'color: #59B278' );
274+
console.log( '%c Disconnected from Optimole API.', 'color: #59B278' );
275275
}
276276
});
277277
};

assets/src/global.d.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,10 +481,9 @@ export interface LatestImages {
481481
no_images_found: string
482482
compression: string
483483
loading_latest_images: string
484-
last: string
485-
saved: string
486-
smaller: string
487-
optimized_images: string
484+
last_optimized_images: string
485+
percentage_saved: string
486+
percentage_smaller: string
488487
same_size: string
489488
small_optimization: string
490489
medium_optimization: string

assets/src/widget/components/WidgetFooter.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Icon, external } from '@wordpress/icons';
22

33
export default function WidgetFooter() {
4-
const { i18n, dashboardURL, adminPageURL } = optimoleDashboardWidget;
4+
const { i18n, dashboardURL, dashboardMetricsURL } = optimoleDashboardWidget;
55

66
return (
77
<div className="flex justify-between gap-4 items-center px-4 py-2 bg-gray-50">
@@ -10,8 +10,9 @@ export default function WidgetFooter() {
1010
<span className="text-base font-bold text-gray-800 group-hover:text-dark-blue transition-colors duration-300">Optimole</span>
1111
</a>
1212

13-
<a href={ adminPageURL } className="text-sm text-info font-medium cursor-pointer hover:text-dark-blue no-underline transition-colors duration-300">
13+
<a href={ dashboardMetricsURL } className="text-sm text-info font-medium cursor-pointer hover:text-dark-blue no-underline transition-colors duration-300 flex items-center gap-1">
1414
{ i18n.viewAllStats }
15+
<Icon icon={ external } className="w-5 h-5 fill-current transition-colors duration-300"/>
1516
</a>
1617
</div>
1718
);

inc/admin.php

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -635,22 +635,17 @@ public function add_notice_upgrade() {
635635
}
636636
?>
637637
<div class="notice optml-notice-optin"
638-
style="background-color: #577BF9; color:white; border: none !important; display: flex;">
638+
style="background-color: #577BF9; color:white; border: none !important; display: flex; align-items: center;">
639639
<div style="margin: 1% 2%;">
640-
<img src='<?php echo OPTML_URL . 'assets/img/upgrade_icon.png'; ?>'>
640+
<img style="max-width: 100px;" src='<?php echo OPTML_URL . 'assets/img/upgrade_icon.png'; ?>'>
641641
</div>
642-
<div style="margin-top: 0.7%;">
642+
<div style="display: grid; gap: 10px;">
643643
<p style="font-size: 16px !important;">
644644
<?php
645645
printf(
646-
/* translators: 1 - opening strong tag, 2 - visits limit, 3 - closing strong tag, 4 - opening strong tag, 5 - closing strong tag, 6 - br tag */
647-
__( '%1$sIt seems you are close to the %2$s visits limit with %3$sOptimole%4$s for this month.%5$s %6$s For a larger quota you may want to check the upgrade plans. If you exceed the quota we will need to deliver back your original, un-optimized images, which might decrease your site speed performance.', 'optimole-wp' ),
648-
'<strong>',
649-
number_format_i18n( 2000 ),
650-
'</strong>',
651-
'<strong>',
652-
'</strong>',
653-
'<br/><br/>'
646+
/* translators: 1 - visits limit */
647+
__( 'You\'re nearing your %1$s-visit monthly cap on Optimole. If you exceed it, we\'ll serve original (unoptimized) images - expect slower pages.', 'optimole-wp' ),
648+
'<strong>' . number_format_i18n( 2000 ) . '</strong>'
654649
);
655650
?>
656651
</p>
@@ -864,7 +859,7 @@ public function add_notice() {
864859
</p>
865860
<div class="actions">
866861
<a href="<?php echo esc_url( admin_url( 'admin.php?page=optimole' ) ); ?>"
867-
class="button button-primary button-hero"><?php _e( 'Connect to OptiMole', 'optimole-wp' ); ?>
862+
class="button button-primary button-hero"><?php _e( 'Connect to Optimole', 'optimole-wp' ); ?>
868863
</a>
869864
<a class="button button-secondary button-hero"
870865
href="<?php echo wp_nonce_url( add_query_arg( [ 'optml_hide_optin' => 'yes' ] ), 'hide_nonce', 'optml_nonce' ); ?>"><?php _e( 'I will do it later', 'optimole-wp' ); ?>
@@ -2286,10 +2281,11 @@ private function get_dashboard_strings() {
22862281
'no_images_found' => sprintf( /* translators: 1 is the starting anchor tag, 2 is the ending anchor tag */ __( 'We are currently optimizing your images. Meanwhile you can visit your %1$shomepage%2$s and check how our plugin performs.', 'optimole-wp' ), '<a href="' . esc_url( home_url() ) . '" target="_blank" >', '</a>' ),
22872282
'compression' => __( 'Optimization', 'optimole-wp' ),
22882283
'loading_latest_images' => __( 'Loading your optimized images...', 'optimole-wp' ),
2289-
'last' => __( 'Last', 'optimole-wp' ),
2290-
'saved' => __( 'Saved', 'optimole-wp' ),
2291-
'smaller' => __( 'smaller', 'optimole-wp' ),
2292-
'optimized_images' => __( 'optimized images', 'optimole-wp' ),
2284+
'last_optimized_images' => __( 'Last optimized images', 'optimole-wp' ),
2285+
// translators: %s is the percentage (e.g. 10%).
2286+
'percentage_saved' => sprintf( __( '%s Saved', 'optimole-wp' ), '{ratio}%' ),
2287+
// translators: %s is the percentage (e.g. 10%).
2288+
'percentage_smaller' => sprintf( __( '%s smaller', 'optimole-wp' ), '{ratio}%' ),
22932289
'same_size' => __( '🙉 We couldn\'t do better, this image is already optimized at maximum.', 'optimole-wp' ),
22942290
'small_optimization' => __( '😬 Not that much, just <strong>{ratio}</strong> smaller.', 'optimole-wp' ),
22952291
'medium_optimization' => __( '🤓 We are on the right track, <strong>{ratio}</strong> squeezed.', 'optimole-wp' ),

0 commit comments

Comments
 (0)