Skip to content

Commit a82ef33

Browse files
committed
remove the translation machinery the package no longer has
Plugin Check reports plugin_header_nonexistent_domain_path: the header still pointed at languages/, which 1.0.4 stopped shipping. The same folder backed a hand-rolled .mo loader and a language selector. The loader could not find a file any more, and the selector promised a switch that did nothing, so all of it goes. The screens follow the site language, which is what WordPress expects, and the number formatting follows the same locale.
1 parent a897e36 commit a82ef33

7 files changed

Lines changed: 27 additions & 91 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ All notable changes to the WordPress plugin are recorded here. The format
44
follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the
55
project uses [semantic versioning](https://semver.org/).
66

7+
## [1.0.5] - 2026-10-23
8+
9+
### Removed
10+
11+
* The `Domain Path` header and the language selector. Plugin Check reports
12+
`plugin_header_nonexistent_domain_path` while the header points at `languages/`,
13+
and after 1.0.4 dropped that folder there was nothing left to point at. The
14+
screens follow the site language, which is what WordPress expects; number
15+
formatting follows the same locale.
16+
717
## [1.0.4] - 2026-10-23
818

919
### Changed

‎README.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ no code from a server of ours, and sends nothing anywhere else.
1414

1515
- **Requires:** WordPress 6.0+, PHP 7.4+
1616
- **Licence:** GPL-2.0-or-later
17-
- **Languages:** English, Русский (follows the site language, can be overridden)
17+
- **Languages:** the screens follow the site language; translations are handled by translate.wordpress.org
1818

1919
## What it does
2020

@@ -90,8 +90,10 @@ The plugin itself sends nothing anywhere except your own PlotBird installation.
9090
php -l plotbird-analytics.php # syntax check
9191
```
9292

93-
Translation files live in `languages/`. The source strings are English; the
94-
Russian catalogue is `plotbird-analytics-ru_RU.po` with the compiled `.mo`.
93+
The `.po` and `.pot` sources live in `languages/`, but they are not part of the
94+
release archive: WordPress.org generates and distributes translations for hosted
95+
plugins. The Russian catalogue is imported into translate.wordpress.org after
96+
approval.
9597

9698
## Licence
9799

‎admin/views/settings-page.php‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -145,20 +145,6 @@
145145
<?php esc_html_e('This link is the key to your numbers. If you revoke it in PlotBird, this page stops showing statistics until you add a new one.', 'plotbird-analytics'); ?>
146146
</p>
147147

148-
<h2><?php esc_html_e('Language', 'plotbird-analytics'); ?></h2>
149-
<p>
150-
<label for="plotbird-language"><?php esc_html_e('Language of these screens', 'plotbird-analytics'); ?></label><br>
151-
<select id="plotbird-language" name="<?php echo esc_attr(PlotBird_Settings::OPTION); ?>[language]">
152-
<?php foreach (PlotBird_Settings::languages() as $plotbird_code => $plotbird_label) : ?>
153-
<option value="<?php echo esc_attr($plotbird_code); ?>" <?php selected($plotbird_code, (string) $settings['language']); ?>>
154-
<?php echo esc_html(PlotBird_Settings::language_label($plotbird_code)); ?>
155-
</option>
156-
<?php endforeach; ?>
157-
</select>
158-
</p>
159-
<p class="description">
160-
<?php esc_html_e('"Site language" follows the language of WordPress, so usually there is nothing to choose here. Pick one only if these screens should be in another language than the rest of the admin.', 'plotbird-analytics'); ?>
161-
</p>
162148

163149
<?php submit_button($plotbird_ready ? __('Save changes', 'plotbird-analytics') : __('Save and continue', 'plotbird-analytics')); ?>
164150
</form>

‎includes/class-plotbird-settings.php‎

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -25,41 +25,7 @@ public static function defaults(): array {
2525
'website_id' => '',
2626
'skip_admins' => 1,
2727
'share_link' => '',
28-
'language' => 'site',
29-
];
30-
}
31-
32-
/**
33-
* Languages the plugin ships translations for.
34-
*
35-
* "site" follows whatever language WordPress itself is set to, which is
36-
* what almost everybody wants: no second setting to keep in step.
37-
*
38-
* The labels are deliberately untranslated. This list is read by the
39-
* plugin_locale filter, and calling __() there would load the text domain
40-
* with the old locale before the filter could return the new one.
41-
*
42-
* @return array<string,string>
43-
*/
44-
public static function languages(): array {
45-
return [
46-
'site' => '',
47-
'en_US' => 'English',
48-
'ru_RU' => 'Русский',
49-
];
50-
}
51-
52-
/**
53-
* The label to show for a language code.
54-
*
55-
* @param string $code One of the keys of languages().
56-
*/
57-
public static function language_label(string $code): string {
58-
if ($code === 'site') {
59-
return __('Site language', 'plotbird-analytics');
60-
}
61-
62-
return self::languages()[$code] ?? $code;
28+
];
6329
}
6430

6531
/**
@@ -200,8 +166,6 @@ public static function sanitize($input): array {
200166
}
201167
$clean['share_link'] = $share;
202168

203-
$language = isset($input['language']) ? (string) $input['language'] : 'site';
204-
$clean['language'] = array_key_exists($language, self::languages()) ? $language : 'site';
205169

206170
return $clean;
207171
}

‎includes/class-plotbird-stats.php‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,11 @@ public static function explain(string $error): string {
173173
/**
174174
* The locale the screens are rendered in.
175175
*
176-
* It is the site's language unless one was chosen on the setup screen, in
177-
* which case the numbers have to follow the text: "50,0%" next to English
178-
* labels reads like a bug.
176+
* The screens follow the site language, so the numbers follow it too:
177+
* "50,0%" next to English labels reads like a bug.
179178
*/
180179
private static function render_locale(): string {
181-
$chosen = (string) PlotBird_Settings::get('language');
182-
183-
return $chosen !== '' && $chosen !== 'site' ? $chosen : get_locale();
180+
return (string) get_locale();
184181
}
185182

186183
/**

‎plotbird-analytics.php‎

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,21 @@
33
* Plugin Name: PlotBird Analytics
44
* Plugin URI: https://github.com/plotbird/wordpress-plugin
55
* Description: Adds the PlotBird tracking code to your site. PlotBird is self-hosted, cookie-free web analytics that runs on ordinary PHP and MySQL hosting.
6-
* Version: 1.0.4
6+
* Version: 1.0.5
77
* Requires at least: 6.0
88
* Requires PHP: 7.4
99
* Author: PlotBird
1010
* Author URI: https://plotbird.github.io/
1111
* License: GPL-2.0-or-later
1212
* License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
1313
* Text Domain: plotbird-analytics
14-
* Domain Path: /languages
1514
*
1615
* @package PlotBird_Analytics
1716
*/
1817

1918
defined('ABSPATH') || exit;
2019

21-
define('PLOTBIRD_ANALYTICS_VERSION', '1.0.4');
20+
define('PLOTBIRD_ANALYTICS_VERSION', '1.0.5');
2221
define('PLOTBIRD_ANALYTICS_FILE', __FILE__);
2322
define('PLOTBIRD_ANALYTICS_DIR', plugin_dir_path(__FILE__));
2423
define('PLOTBIRD_ANALYTICS_URL', plugin_dir_url(__FILE__));
@@ -30,33 +29,6 @@
3029
require_once PLOTBIRD_ANALYTICS_DIR . 'includes/class-plotbird-chart.php';
3130
require_once PLOTBIRD_ANALYTICS_DIR . 'includes/class-plotbird-admin.php';
3231

33-
/**
34-
* Load the translations, either for the site's language or for the one chosen
35-
* on the setup screen.
36-
*
37-
* Following the site is the default and needs no call at all: WordPress loads
38-
* languages/plotbird-analytics-<locale>.mo by itself, and on WordPress.org the
39-
* language packs do the same. When a language is chosen explicitly the catalogue
40-
* has to be loaded by hand, because WordPress 6.7 loads translations just in time
41-
* using the site locale and ignores the plugin_locale filter.
42-
*/
43-
add_action('init', static function (): void {
44-
$chosen = (string) PlotBird_Settings::get('language');
45-
46-
if ($chosen === 'site' || $chosen === '') {
47-
return;
48-
}
49-
50-
$file = PLOTBIRD_ANALYTICS_DIR . 'languages/plotbird-analytics-' . $chosen . '.mo';
51-
52-
if (!is_file($file)) {
53-
return;
54-
}
55-
56-
unload_textdomain('plotbird-analytics');
57-
load_textdomain('plotbird-analytics', $file);
58-
}, 1);
59-
6032
/**
6133
* Store the default settings on activation, without overwriting a repeat run.
6234
*/

‎readme.txt‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tags: analytics, statistics, privacy, cookieless, self-hosted
44
Requires at least: 6.0
55
Tested up to: 7.1
66
Requires PHP: 7.4
7-
Stable tag: 1.0.4
7+
Stable tag: 1.0.5
88
License: GPL-2.0-or-later
99
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
1010

@@ -89,6 +89,11 @@ running, because it is a separate application.
8989

9090
== Changelog ==
9191

92+
= 1.0.5 =
93+
* The plugin screens follow the site language. The former language
94+
selector is gone: translations are provided by translate.wordpress.org,
95+
and the separate selector no longer had anything to switch.
96+
9297
= 1.0.4 =
9398
* The admin menu entry sits at the bottom of the menu instead of above the
9499
core items, so nothing WordPress itself provides is pushed down.

0 commit comments

Comments
 (0)