Preferred Languages - Version 1.7.1

Version Description

This release contains improvements to translation merging and fixes issues with the user language not being correctly applied.

Download this release

Release Info

Developer swissspidy
Plugin Icon Preferred Languages
Version 1.7.1
Comparing to
See all releases

Code changes from version 1.7.0 to 1.7.1

inc/default-filters.php CHANGED
@@ -26,8 +26,10 @@ add_filter( 'pre_update_site_option', 'preferred_languages_pre_update_option', 1
26
  add_filter( 'update_option_preferred_languages', 'preferred_languages_update_option', 10, 2 );
27
  add_filter( 'update_site_option_preferred_languages', 'preferred_languages_update_site_option', 10, 2 );
28
  add_filter( 'update_user_metadata', 'preferred_languages_pre_update_user_meta', 10, 5 );
29
- add_filter( 'update_user_meta', 'preferred_languages_update_user_meta', 10, 4 );
30
  add_filter( 'get_user_metadata', 'preferred_languages_filter_user_locale', 10, 3 );
31
  add_filter( 'locale', 'preferred_languages_filter_locale', 5 ); // Before WP_Locale_Switcher.
 
32
  add_filter( 'load_textdomain_mofile', 'preferred_languages_load_textdomain_mofile', 10, 2 );
 
33
  add_filter( 'load_script_translation_file', 'preferred_languages_load_script_translation_file' );
26
  add_filter( 'update_option_preferred_languages', 'preferred_languages_update_option', 10, 2 );
27
  add_filter( 'update_site_option_preferred_languages', 'preferred_languages_update_site_option', 10, 2 );
28
  add_filter( 'update_user_metadata', 'preferred_languages_pre_update_user_meta', 10, 5 );
29
+ add_action( 'update_user_meta', 'preferred_languages_update_user_meta', 10, 4 );
30
  add_filter( 'get_user_metadata', 'preferred_languages_filter_user_locale', 10, 3 );
31
  add_filter( 'locale', 'preferred_languages_filter_locale', 5 ); // Before WP_Locale_Switcher.
32
+ add_filter( 'override_load_textdomain', 'preferred_languages_override_load_textdomain', 10, 3 );
33
  add_filter( 'load_textdomain_mofile', 'preferred_languages_load_textdomain_mofile', 10, 2 );
34
+ add_filter( 'pre_load_script_translations', 'preferred_languages_pre_load_script_translations', 10, 4 );
35
  add_filter( 'load_script_translation_file', 'preferred_languages_load_script_translation_file' );
inc/functions.php CHANGED
@@ -80,7 +80,17 @@ function preferred_languages_get_user_list( $user_id = 0 ) {
80
  }
81
 
82
  $preferred_languages = get_user_meta( $user->ID, 'preferred_languages', true );
83
- return array_filter( explode( ',', $preferred_languages ) );
 
 
 
 
 
 
 
 
 
 
84
  }
85
 
86
  /**
@@ -169,7 +179,11 @@ function preferred_languages_pre_update_user_meta( $check, $user_id, $meta_key,
169
  }
170
 
171
  /**
172
- * Downloads language pack when updating user meta.
 
 
 
 
173
  *
174
  * @since 1.3.0
175
  *
@@ -183,19 +197,26 @@ function preferred_languages_update_user_meta( $meta_id, $object_id, $meta_key,
183
  return;
184
  }
185
 
 
 
 
 
 
 
186
  remove_filter( 'update_user_meta', 'preferred_languages_update_user_meta' );
187
 
188
  $locales = array_filter( explode( ',', $meta_value ) );
189
  $installed_languages = preferred_languages_download_language_packs( $locales );
190
 
191
- // Only store actually installed languages in option.
192
  update_user_meta( $object_id, 'preferred_languages', implode( ',', $installed_languages ) );
193
 
194
  add_filter( 'update_user_meta', 'preferred_languages_update_user_meta', 10, 4 );
195
 
196
  // Reload translations after save.
197
- $preferred_languages_list = preferred_languages_get_user_list( $object_id );
198
- load_default_textdomain( reset( $preferred_languages_list ) );
 
199
  }
200
 
201
  /**
@@ -239,8 +260,7 @@ function preferred_languages_update_option( $old_value, $value ) {
239
  add_filter( 'update_option_preferred_languages', 'preferred_languages_update_option', 10, 2 );
240
 
241
  // Reload translations after save.
242
- $preferred_languages_list = preferred_languages_get_site_list();
243
- load_default_textdomain( reset( $preferred_languages_list ) );
244
  }
245
 
246
  /**
@@ -263,8 +283,7 @@ function preferred_languages_update_site_option( $old_value, $value ) {
263
  add_filter( 'update_site_option_preferred_languages', 'preferred_languages_update_option', 10, 2 );
264
 
265
  // Reload translations after save.
266
- $preferred_languages_list = preferred_languages_get_network_list();
267
- load_default_textdomain( reset( $preferred_languages_list ) );
268
  }
269
 
270
  /**
@@ -323,7 +342,7 @@ function preferred_languages_download_language_packs( $locales ) {
323
  * @return string Sanitized list.
324
  */
325
  function preferred_languages_sanitize_list( $preferred_languages ) {
326
- $locales = array_map( 'sanitize_text_field', explode( ',', $preferred_languages ) );
327
 
328
  return implode( ',', $locales );
329
  }
@@ -374,37 +393,40 @@ function preferred_languages_filter_user_locale( $value, $object_id, $meta_key )
374
  return reset( $preferred_languages );
375
  }
376
 
377
- return $value;
 
 
 
 
 
378
  }
379
 
380
  /**
381
- * Filters load_textdomain() calls to respect the list of preferred languages.
382
  *
383
- * @since 1.0.0
384
  *
385
- * @param string $mofile Path to the MO file.
386
- * @param string $domain Text domain. Unique identifier for retrieving translated strings.
387
  *
388
- * @return string The modified MO file path.
 
 
 
389
  */
390
- function preferred_languages_load_textdomain_mofile( $mofile, $domain ) {
391
  $preferred_locales = preferred_languages_get_list();
392
 
393
  if ( empty( $preferred_locales ) ) {
394
- return $mofile;
395
  }
396
 
397
- $current_locale = get_locale();
398
 
399
  // Locale has been filtered by something else.
400
  if ( ! in_array( $current_locale, $preferred_locales, true ) ) {
401
- return $mofile;
402
  }
403
 
404
- $first_mofile = null;
405
-
406
- remove_filter( 'load_textdomain_mofile', 'preferred_languages_load_textdomain_mofile' );
407
-
408
  /**
409
  * Filters whether translations should be merged with existing ones.
410
  *
@@ -416,31 +438,152 @@ function preferred_languages_load_textdomain_mofile( $mofile, $domain ) {
416
  */
417
  $merge_translations = apply_filters( 'preferred_languages_merge_translations', false, $domain, $current_locale );
418
 
 
 
 
 
 
 
 
 
 
419
  foreach ( $preferred_locales as $locale ) {
420
  $preferred_mofile = str_replace( $current_locale, $locale, $mofile );
421
 
422
  if ( is_readable( $preferred_mofile ) ) {
423
- if ( ! $merge_translations ) {
424
- return $preferred_mofile;
425
- }
426
 
427
- load_textdomain( $domain, $preferred_mofile );
428
-
429
- if ( null === $first_mofile ) {
430
  $first_mofile = $preferred_mofile;
431
  }
432
  }
433
  }
434
 
 
435
  add_filter( 'load_textdomain_mofile', 'preferred_languages_load_textdomain_mofile', 10, 2 );
436
 
437
  if ( null !== $first_mofile ) {
438
- return $first_mofile;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
  }
440
 
441
  return $mofile;
442
  }
443
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
  /**
445
  * Filters load_script_translation_file() calls to respect the list of preferred languages.
446
  *
@@ -471,7 +614,7 @@ function preferred_languages_load_script_translation_file( $file ) {
471
  foreach ( $preferred_locales as $locale ) {
472
  $preferred_file = str_replace( $current_locale, $locale, $file );
473
 
474
- if ( is_readable( $preferred_file ) ) {
475
  return $preferred_file;
476
  }
477
  }
@@ -641,6 +784,9 @@ function preferred_languages_display_form( $args = array() ) {
641
  )
642
  );
643
 
 
 
 
644
  require_once ABSPATH . 'wp-admin/includes/translation-install.php';
645
  $translations = wp_get_available_translations();
646
 
@@ -648,7 +794,7 @@ function preferred_languages_display_form( $args = array() ) {
648
 
649
  $preferred_languages = array();
650
 
651
- foreach ( (array) $args['selected'] as $locale ) {
652
  if ( isset( $translations[ $locale ] ) ) {
653
  $translation = $translations[ $locale ];
654
 
@@ -672,6 +818,8 @@ function preferred_languages_display_form( $args = array() ) {
672
  }
673
  }
674
 
 
 
675
  /* translators: accessibility text */
676
  $label_up = __( 'Move up (Alt+Up)', 'preferred-languages' );
677
 
@@ -686,7 +834,7 @@ function preferred_languages_display_form( $args = array() ) {
686
 
687
  ?>
688
  <div class="preferred-languages">
689
- <input type="hidden" name="preferred_languages" value="<?php echo esc_attr( implode( ',', $args['selected'] ) ); ?>"/>
690
  <p><?php _e( 'Choose languages for displaying WordPress in, in order of preference.', 'preferred-languages' ); ?></p>
691
  <div class="active-locales wp-clearfix">
692
  <?php
@@ -713,13 +861,13 @@ function preferred_languages_display_form( $args = array() ) {
713
  role="listbox"
714
  aria-labelledby="preferred-languages-label"
715
  tabindex="0"
716
- aria-activedescendant="<?php echo empty( $preferred_languages ) ? '' : esc_attr( get_locale() ); ?>"
717
  id="preferred_languages"
718
  class="active-locales-list <?php echo empty( $preferred_languages ) ? 'empty-list' : ''; ?>">
719
  <?php foreach ( $preferred_languages as $language ) : ?>
720
  <li
721
  role="option"
722
- aria-selected="<?php echo get_locale() === $language['language'] ? 'true' : 'false'; ?>"
723
  id="<?php echo esc_attr( $language['language'] ); ?>"
724
  class="active-locale">
725
  <?php echo esc_html( $language['native_name'] ); ?>
@@ -868,7 +1016,7 @@ function preferred_languages_filter_gettext( $translation, $text, $domain ) {
868
  $preferred_locales = preferred_languages_get_list();
869
 
870
  // Locale has been filtered by something else.
871
- if ( ! in_array( get_locale(), $preferred_locales, true ) ) {
872
  return $translation;
873
  }
874
 
80
  }
81
 
82
  $preferred_languages = get_user_meta( $user->ID, 'preferred_languages', true );
83
+ $preferred_languages = array_filter( explode( ',', $preferred_languages ) );
84
+
85
+ if ( ! empty( $preferred_languages ) ) {
86
+ return $preferred_languages;
87
+ }
88
+
89
+ remove_filter( 'get_user_metadata', 'preferred_languages_filter_user_locale' );
90
+ $locale = get_user_meta( $user->ID, 'locale', true );
91
+ add_filter( 'get_user_metadata', 'preferred_languages_filter_user_locale', 10, 3 );
92
+
93
+ return empty( $locale ) ? false : array( $locale );
94
  }
95
 
96
  /**
179
  }
180
 
181
  /**
182
+ * Hooks into user meta updates.
183
+ *
184
+ * Downloads language pack when updating list of preferred languages.
185
+ *
186
+ * Also updates the 'locale' user meta if the list is empty.
187
  *
188
  * @since 1.3.0
189
  *
197
  return;
198
  }
199
 
200
+ // Clearing the preferred languages list should also clear the 'locale' user meta
201
+ // to prevent stale data.
202
+ if ( empty( $meta_value ) ) {
203
+ update_user_meta( $object_id, 'locale', '' );
204
+ }
205
+
206
  remove_filter( 'update_user_meta', 'preferred_languages_update_user_meta' );
207
 
208
  $locales = array_filter( explode( ',', $meta_value ) );
209
  $installed_languages = preferred_languages_download_language_packs( $locales );
210
 
211
+ // Only store actually installed languages in user meta.
212
  update_user_meta( $object_id, 'preferred_languages', implode( ',', $installed_languages ) );
213
 
214
  add_filter( 'update_user_meta', 'preferred_languages_update_user_meta', 10, 4 );
215
 
216
  // Reload translations after save.
217
+ if ( get_current_user_id() === $object_id ) {
218
+ load_default_textdomain( determine_locale() );
219
+ }
220
  }
221
 
222
  /**
260
  add_filter( 'update_option_preferred_languages', 'preferred_languages_update_option', 10, 2 );
261
 
262
  // Reload translations after save.
263
+ load_default_textdomain( determine_locale() );
 
264
  }
265
 
266
  /**
283
  add_filter( 'update_site_option_preferred_languages', 'preferred_languages_update_option', 10, 2 );
284
 
285
  // Reload translations after save.
286
+ load_default_textdomain( determine_locale() );
 
287
  }
288
 
289
  /**
342
  * @return string Sanitized list.
343
  */
344
  function preferred_languages_sanitize_list( $preferred_languages ) {
345
+ $locales = array_unique( array_map( 'sanitize_text_field', wp_parse_list( $preferred_languages ) ) );
346
 
347
  return implode( ',', $locales );
348
  }
393
  return reset( $preferred_languages );
394
  }
395
 
396
+ /**
397
+ * Returning an empty string will force WordPress to fall back to {@see get_locale},
398
+ * which is filtered by {@see preferred_languages_filter_locale} to use the site's
399
+ * preferred languages list.
400
+ */
401
+ return '';
402
  }
403
 
404
  /**
405
+ * Filters whether to override the .mo file loading.
406
  *
407
+ * Used for supporting translation merging.
408
  *
409
+ * @since 1.7.1
 
410
  *
411
+ * @param bool $override Whether to override the .mo file loading. Default false.
412
+ * @param string $domain Text domain. Unique identifier for retrieving translated strings.
413
+ * @param string $mofile Path to the MO file.
414
+ * @return bool Whether to override the .mo file loading.
415
  */
416
+ function preferred_languages_override_load_textdomain( $override, $domain, $mofile ) {
417
  $preferred_locales = preferred_languages_get_list();
418
 
419
  if ( empty( $preferred_locales ) ) {
420
+ return $override;
421
  }
422
 
423
+ $current_locale = determine_locale();
424
 
425
  // Locale has been filtered by something else.
426
  if ( ! in_array( $current_locale, $preferred_locales, true ) ) {
427
+ return $override;
428
  }
429
 
 
 
 
 
430
  /**
431
  * Filters whether translations should be merged with existing ones.
432
  *
438
  */
439
  $merge_translations = apply_filters( 'preferred_languages_merge_translations', false, $domain, $current_locale );
440
 
441
+ if ( ! $merge_translations ) {
442
+ return $override;
443
+ }
444
+
445
+ $first_mofile = null;
446
+
447
+ remove_filter( 'override_load_textdomain', 'preferred_languages_override_load_textdomain' );
448
+ remove_filter( 'load_textdomain_mofile', 'preferred_languages_load_textdomain_mofile' );
449
+
450
  foreach ( $preferred_locales as $locale ) {
451
  $preferred_mofile = str_replace( $current_locale, $locale, $mofile );
452
 
453
  if ( is_readable( $preferred_mofile ) ) {
454
+ $loaded = load_textdomain( $domain, $preferred_mofile );
 
 
455
 
456
+ if ( null === $first_mofile && $loaded ) {
 
 
457
  $first_mofile = $preferred_mofile;
458
  }
459
  }
460
  }
461
 
462
+ add_filter( 'override_load_textdomain', 'preferred_languages_override_load_textdomain', 10, 3 );
463
  add_filter( 'load_textdomain_mofile', 'preferred_languages_load_textdomain_mofile', 10, 2 );
464
 
465
  if ( null !== $first_mofile ) {
466
+ return true;
467
+ }
468
+
469
+ return $override;
470
+ }
471
+
472
+ /**
473
+ * Filters load_textdomain() calls to respect the list of preferred languages.
474
+ *
475
+ * @since 1.0.0
476
+ *
477
+ * @param string $mofile Path to the MO file.
478
+ * @param string $domain Text domain. Unique identifier for retrieving translated strings.
479
+ *
480
+ * @return string The modified MO file path.
481
+ */
482
+ function preferred_languages_load_textdomain_mofile( $mofile, $domain ) {
483
+ $preferred_locales = preferred_languages_get_list();
484
+
485
+ if ( empty( $preferred_locales ) ) {
486
+ return $mofile;
487
+ }
488
+
489
+ $current_locale = determine_locale();
490
+
491
+ // Locale has been filtered by something else.
492
+ if ( ! in_array( $current_locale, $preferred_locales, true ) ) {
493
+ return $mofile;
494
+ }
495
+
496
+ foreach ( $preferred_locales as $locale ) {
497
+ $preferred_mofile = str_replace( $current_locale, $locale, $mofile );
498
+
499
+ if ( 'en_US' === $locale || is_readable( $preferred_mofile ) ) {
500
+ return $preferred_mofile;
501
+ }
502
  }
503
 
504
  return $mofile;
505
  }
506
 
507
+ /**
508
+ * Pre-filters script translations for the given file, script handle and text domain.
509
+ *
510
+ * Used for supporting translation merging.
511
+ *
512
+ * @since 1.7.1
513
+ *
514
+ * @param string|false|null $translations JSON-encoded translation data. Default null.
515
+ * @param string|false $file Path to the translation file to load. False if there isn't one.
516
+ * @param string $handle Name of the script to register a translation domain to.
517
+ * @param string $domain The text domain.
518
+ * @return string|false|null JSON-encoded translation data.
519
+ */
520
+ function preferred_languages_pre_load_script_translations( $translations, $file, $handle, $domain ) {
521
+ $preferred_locales = preferred_languages_get_list();
522
+
523
+ if ( empty( $preferred_locales ) ) {
524
+ return $translations;
525
+ }
526
+
527
+ $current_locale = determine_locale();
528
+
529
+ // Locale has been filtered by something else.
530
+ if ( ! in_array( $current_locale, $preferred_locales, true ) ) {
531
+ return $translations;
532
+ }
533
+
534
+ /** This filter is documented in inc/functions.php */
535
+ $merge_translations = apply_filters( 'preferred_languages_merge_translations', false, $domain, $current_locale );
536
+
537
+ if ( ! $merge_translations ) {
538
+ return $translations;
539
+ }
540
+
541
+ remove_filter( 'pre_load_script_translations', 'preferred_languages_pre_load_script_translations' );
542
+ remove_filter( 'load_script_translation_file', 'preferred_languages_load_script_translation_file' );
543
+
544
+ $all_translations = null;
545
+
546
+ foreach ( $preferred_locales as $locale ) {
547
+ $preferred_file = str_replace( $current_locale, $locale, $file );
548
+
549
+ if ( is_readable( $preferred_file ) ) {
550
+ $translations = load_script_translations( $preferred_file, $handle, $domain );
551
+
552
+ if ( ! $translations ) {
553
+ continue;
554
+ }
555
+
556
+ if ( ! $all_translations ) {
557
+ $all_translations = $translations;
558
+ continue;
559
+ }
560
+
561
+ // Some translations have already been loaded before, merge them.
562
+ $all_translations_json = json_decode( $all_translations, true );
563
+ $translations_json = json_decode( $translations, true );
564
+
565
+ foreach ( $translations_json['locale_data']['messages'] as $key => $translation ) {
566
+ if ( isset( $all_translations_json['locale_data']['messages'][ $key ] ) ) {
567
+ continue;
568
+ }
569
+
570
+ $all_translations_json['locale_data']['messages'][ $key ] = $translation;
571
+ }
572
+
573
+ $all_translations = wp_json_encode( $all_translations_json );
574
+ }
575
+ }
576
+
577
+ add_filter( 'override_load_textdomain', 'preferred_languages_override_load_textdomain', 10, 4 );
578
+ add_filter( 'load_textdomain_mofile', 'preferred_languages_load_script_translation_file' );
579
+
580
+ if ( $all_translations ) {
581
+ return $all_translations;
582
+ }
583
+
584
+ return $translations;
585
+ }
586
+
587
  /**
588
  * Filters load_script_translation_file() calls to respect the list of preferred languages.
589
  *
614
  foreach ( $preferred_locales as $locale ) {
615
  $preferred_file = str_replace( $current_locale, $locale, $file );
616
 
617
+ if ( 'en_US' === $locale || is_readable( $preferred_file ) ) {
618
  return $preferred_file;
619
  }
620
  }
784
  )
785
  );
786
 
787
+ // Filter 'false' being passed here.
788
+ $selected = array_filter( (array) $args['selected'] );
789
+
790
  require_once ABSPATH . 'wp-admin/includes/translation-install.php';
791
  $translations = wp_get_available_translations();
792
 
794
 
795
  $preferred_languages = array();
796
 
797
+ foreach ( $selected as $locale ) {
798
  if ( isset( $translations[ $locale ] ) ) {
799
  $translation = $translations[ $locale ];
800
 
818
  }
819
  }
820
 
821
+ $current_locale = determine_locale();
822
+
823
  /* translators: accessibility text */
824
  $label_up = __( 'Move up (Alt+Up)', 'preferred-languages' );
825
 
834
 
835
  ?>
836
  <div class="preferred-languages">
837
+ <input type="hidden" name="preferred_languages" value="<?php echo esc_attr( implode( ',', $selected ) ); ?>"/>
838
  <p><?php _e( 'Choose languages for displaying WordPress in, in order of preference.', 'preferred-languages' ); ?></p>
839
  <div class="active-locales wp-clearfix">
840
  <?php
861
  role="listbox"
862
  aria-labelledby="preferred-languages-label"
863
  tabindex="0"
864
+ aria-activedescendant="<?php echo empty( $preferred_languages ) ? '' : esc_attr( $current_locale ); ?>"
865
  id="preferred_languages"
866
  class="active-locales-list <?php echo empty( $preferred_languages ) ? 'empty-list' : ''; ?>">
867
  <?php foreach ( $preferred_languages as $language ) : ?>
868
  <li
869
  role="option"
870
+ aria-selected="<?php echo $current_locale === $language['language'] ? 'true' : 'false'; ?>"
871
  id="<?php echo esc_attr( $language['language'] ); ?>"
872
  class="active-locale">
873
  <?php echo esc_html( $language['native_name'] ); ?>
1016
  $preferred_locales = preferred_languages_get_list();
1017
 
1018
  // Locale has been filtered by something else.
1019
+ if ( ! in_array( determine_locale(), $preferred_locales, true ) ) {
1020
  return $translation;
1021
  }
1022
 
preferred-languages.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Preferred Languages
4
  * Plugin URI: https://github.com/swissspidy/preferred-languages/
5
  * Description: Choose languages for displaying WordPress in, in order of preference.
6
- * Version: 1.7.0
7
  * Author: Pascal Birchler
8
  * Author URI: https://pascalbirchler.com
9
  * License: GPL-2.0+
3
  * Plugin Name: Preferred Languages
4
  * Plugin URI: https://github.com/swissspidy/preferred-languages/
5
  * Description: Choose languages for displaying WordPress in, in order of preference.
6
+ * Version: 1.7.1
7
  * Author: Pascal Birchler
8
  * Author URI: https://pascalbirchler.com
9
  * License: GPL-2.0+
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Preferred Languages ===
2
  Contributors: swissspidy
3
  Tags: internationalization, i18n, localization, l10n, language, locale, translation
4
- Tested up to: 5.7
5
- Stable tag: 1.7.0
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
 
@@ -33,6 +33,10 @@ For the plugin's changelog, please head over to [the GitHub repository](https://
33
 
34
  == Upgrade Notice ==
35
 
 
 
 
 
36
  = 1.7.0 =
37
 
38
  This release improves Multisite support and contains a new `preferred_languages_merge_translations` filter that allows merging translations.
1
  === Preferred Languages ===
2
  Contributors: swissspidy
3
  Tags: internationalization, i18n, localization, l10n, language, locale, translation
4
+ Tested up to: 5.8
5
+ Stable tag: 1.7.1
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
 
33
 
34
  == Upgrade Notice ==
35
 
36
+ = 1.7.1 =
37
+
38
+ This release contains improvements to translation merging and fixes issues with the user language not being correctly applied.
39
+
40
  = 1.7.0 =
41
 
42
  This release improves Multisite support and contains a new `preferred_languages_merge_translations` filter that allows merging translations.
uninstall.php CHANGED
@@ -10,4 +10,5 @@
10
  defined( 'WP_UNINSTALL_PLUGIN' ) or die;
11
 
12
  delete_option( 'preferred_languages' );
 
13
  delete_metadata( 'user', null, 'preferred_languages', '', true );
10
  defined( 'WP_UNINSTALL_PLUGIN' ) or die;
11
 
12
  delete_option( 'preferred_languages' );
13
+ delete_site_option( 'preferred_languages' );
14
  delete_metadata( 'user', null, 'preferred_languages', '', true );