-
Notifications
You must be signed in to change notification settings - Fork 10
/
readme.txt
283 lines (218 loc) · 7.54 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
=== Cyr-To-Lat ===
Contributors: SergeyBiryukov, mihdan, kaggdesign, karevn, webvitaly
Tags: cyrillic, slugs, translation, transliteration
Requires at least: 5.3
Tested up to: 6.7
Stable tag: 6.2.1
Requires PHP: 7.2.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Convert Non-Latin characters in post, page and term slugs to Latin characters.
== Description ==
Converts Cyrillic characters in post, page and term slugs to Latin characters. Useful for creating human-readable URLs.
= Features =
* The only plugin with fully editable transliteration table. Allows to add/remove and edit pairs like 'Я' => 'Ya', or even 'Пиво' => 'Beer'
* Converts any number of existing post, page and term slugs in background processes
* Saves existing post and page permalinks integrity
* Performs transliteration of attachment file names
* The plugin supports Russian, Belorussian, Ukrainian, Bulgarian, Macedonian, Serbian, Greek, Armenian, Georgian, Kazakh, Hebrew, and Chinese characters
* [Has many advantages over similar plugins](https://kagg.eu/en/the-benefits-of-cyr-to-lat/)
* [Officially compatible with WPML](https://wpml.org/plugin/cyr-to-lat/)
<img src="https://ps.w.org/cyr2lat/assets/Cyr-To-Lat---WPML-Compatibility-Certificate-240x250.png" alt="WPML Certificate" />
Based on the original Rus-To-Lat plugin by Anton Skorobogatov.
Sponsored by [Blackfire](https://www.blackfire.io/).
<img src="https://ps.w.org/cyr2lat/assets/blackfire-io_secondary_horizontal_transparent-250x62.png" alt="Blackfire Logo" />
== Screenshots ==
1. Tables settings page
2. Converter settings page
3. Block editor with transliterated slug
4. WPML Certificate
== Plugin Support ==
* [Support Forum](https://wordpress.org/support/plugin/cyr2lat/)
* [Telegram Group](https://t.me/cyr2lat)
== Installation ==
1. Upload `cyr2lat` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
== Frequently Asked Questions ==
= How can I define my own substitutions? =
Add this code to your theme's `functions.php` file:
`
/**
* Modify conversion table.
*
* @param array $table Conversion table.
*
* @return array
*/
function my_ctl_table( $table ) {
$table['Ъ'] = 'U';
$table['ъ'] = 'u';
return $table;
}
add_filter( 'ctl_table', 'my_ctl_table' );
`
= How can I redefine non-standard locale? =
For instance, if your non-standard locale is uk_UA, you can redefine it to `uk` by adding the following code to your theme's `function.php` file:
`
/**
* Use non-standard locale.
*
* @param string $locale Current locale.
*
* @return string
*/
function my_ctl_locale( $locale ) {
if ( 'uk_UA' === $locale ) {
return 'uk';
}
return $locale;
}
add_filter( 'ctl_locale', 'my_ctl_locale' );
`
= How can I define my own transliteration of titles? =
Add similar code to your theme's `functions.php` file:
`
/**
* Filter title before sanitizing.
*
* @param string|false $result Sanitized title.
* @param string $title Title.
*
* @return string|false
*/
function my_ctl_pre_sanitize_title( $result, $title ) {
if ( 'пиво' === $title ) {
return 'beer';
}
return $result;
}
add_filter( 'ctl_pre_sanitize_title', 10, 2 );
`
= How can I define my own transliteration of filenames? =
Add similar code to your theme's `functions.php` file:
`
/**
* Filter filename before sanitizing.
*
* @param string|false $result Sanitized filename.
* @param string $filename Title.
*
* @return string|false
*/
function my_ctl_pre_sanitize_filename( $result, $filename ) {
if ( 'пиво' === $filename ) {
return 'beer';
}
return $result;
}
add_filter( 'ctl_pre_sanitize_filename', 10, 2 );
`
= How can I allow the plugin to work on the frontend? =
Add the following code to your plugin's (or mu-plugin's) main file. This code won't work being added to a theme's functions.php file.
`
/**
* Filter status allowed Cyr To Lat plugin to work.
*
* @param bool $allowed
*
* @return bool
*/
function my_ctl_allow( bool $allowed ): bool {
$uri = isset( $_SERVER['REQUEST_URI'] ) ?
sanitize_url( wp_unslash( $_SERVER['REQUEST_URI'] ) ) :
'';
if ( 0 === strpos( $uri, '/divi-comments' ) ) {
return true;
}
return $allowed;
}
add_filter( 'ctl_allow', 'my_ctl_allow' );
`
= How can I limit post types for background conversion? =
Add similar code to your theme's `functions.php` file:
`
/**
* Filter post types allowed for background conversion.
*
* @param array $post_types Allowed post types.
*
* @return array
*/
function my_ctl_post_types( $post_types ) {
return [
'post' => 'post',
'page' => 'page',
'attachment' => 'attachment',
'product' => 'product',
'nav_menu_item' => 'nav_menu_item',
];
}
add_filter( 'ctl_post_types', 'my_ctl_post_types' );
`
= How can I convert many posts/terms using wp-cli? =
Use the following command in the console:
`
wp cyr2lat regenerate [--post_type=<post_type>] [--post_status=<post_status>]
`
Where
`-post_type` is a list of post types,
`-post_status` is a list of post statuses.
= How can I regenerate thumbnails safely? =
Regeneration of thumbnails with the command `wp media regenerate` can break links in old posts as file names become transliterated.
To avoid it, deactivate cyr2lat plugin during regeneration:
`
wp media regenerate --skip-plugins=cyr2lat
`
= Can I contribute? =
Yes, you can!
* Join in on our [GitHub repository](https://github.com/mihdan/cyr2lat)
* Join in on our [Telegram Group](https://t.me/cyr2lat)
== Changelog ==
= 6.2.1 (13.11.2024) =
* Fixed layout of the Converter page.
* Fixed issues reported by Plugin Check Plugin.
= 6.2.0 (13.11.2024) =
* Dropped support for PHP 7.0 and 7.1. The minimum required PHP version is now 7.2.
* The minimum required WordPress version is now 5.3.
* Fixed the notice about the _load_textdomain_just_in_time function being called incorrectly.
* Tested with WordPress 6.7.
* Tested with WooCommerce 9.4.
= 6.1.0 (09.03.2024) =
* Tested with WordPress 6.5.
* Tested with WooCommerce 8.6.
* Fixed error on System Info tab when post types or post statuses are not set.
= 6.0.8 (14.02.2024) =
* Improved detection of the Gutenberg editor.
* Fixed processing of product attributes.
= 6.0.7 (11.02.2024) =
* Tested with WooCommerce 8.5.
* Added redirect from the cyrillic post title when creating a new post.
* Added description of post types and post statuses on the Converter page.
* Fixed displaying all file descriptions in the Theme Editor in the current locale.
* Fixed PHP warning in SettingsBase.
* Fixed output of variable product attributes.
= 6.0.6 (14.01.2024) =
* Tested with WordPress 6.4.
* Tested with WooCommerce 8.4.
* Tested with PHP 8.3.
* Fixed documentation on ctl_allow filter.
* Fixed improper display of the "rate plugin" message on options.php.
= 6.0.5 (09.10.2023) =
* Fixed displaying file descriptions in the Theme Editor; now in the current locale.
= 6.0.4 (23.09.2023) =
* Fixed disappeared file descriptions on the Theme File Editor page.
= 6.0.3 (29.07.2023) =
* Fixed the fatal error with Jetpack sync.
= 6.0.2 (26.07.2023) =
* Fixed fatal error in admin_footer_text().
= 6.0.1 (26.07.2023) =
* Fixed the fatal error on the System Info page with empty options.
= 6.0.0 (26.07.2023) =
* Dropped support of PHP 5.6. The Minimum required PHP version is 7.0 now.
* Tested with WordPress 6.3.
* Tested with WooCommerce 7.9.
* Added System Info tab.
* Added filter 'ctl_allow'
* Fixed console error when saving table data.
* Fixed the current table setting on the Tables page with WPML.
[See changelog for all versions](https://plugins.svn.wordpress.org/cyr2lat/trunk/changelog.txt).