-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtranslation.php
97 lines (72 loc) · 2.09 KB
/
translation.php
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
<?php
/*
Plugin Name: Kino Translations
Plugin URI:
Description: Custom translations for KinoGeneva
Version: 1.0.0
Author: Collectif WP
Author URI: http://collectifwp.ch/
*/
/*
* PLUGINS : LE NOUVEAU CODE QUI MARCHE :
* Replace 'textdomain' with your plugin's textdomain. e.g. 'woocommerce'.
* File to be named, for example, yourtranslationfile-en_GB.mo
* File to be placed, for example, wp-content/lanaguages/textdomain/yourtranslationfile-en_GB.mo
*/
function load_custom_plugin_translation_file( $mofile, $domain ) {
// folder location
$folder = WP_PLUGIN_DIR . '/kinogeneva-translations/languages/';
// filename ending
$file = '-' . get_locale() . '.mo';
$plugins = array(
'buddypress',
'bxcft',
'wp-user-groups',
'kleo_framework',
'invite-anyone',
'bp-groups-taxo',
'bp-docs'
);
foreach ($plugins as &$plugin) {
if ( $plugin === $domain ) {
$mofile = $folder.$domain.$file;
}
}
return $mofile;
}
add_filter( 'load_textdomain_mofile', 'load_custom_plugin_translation_file', 10, 2 );
// chargement du fichier de personnalisation des localisations
function load_custom_kinogeneva_translation_file() {
$mofile = WP_PLUGIN_DIR . '/kinogeneva-translations/languages/kinogeneva-' . get_locale() . '.mo';
load_textdomain( 'kinogeneva', $mofile );
}
add_action( 'init', 'load_custom_kinogeneva_translation_file' );
/**
* L'ANCIEN CODE QUI NE MARCHE PLUS depuis WP 4.6 ....
*/
// remove_action( 'bp_core_loaded', 'bp_core_load_buddypress_textdomain' );
// = completely disables the buddypress translation
// add_action( 'plugins_loaded', 'kino_load_textdomain', 1 ); // must be earlier than 10!
function kino_load_textdomain() {
// BP group announcements
load_plugin_textdomain(
'bpga',
false,
'kinogeneva-translations/languages/'
);
// BP group calendar
load_plugin_textdomain(
'groupcalendar',
false,
'kinogeneva-translations/languages/'
);
// BuddyPress Group Email Subscription
load_plugin_textdomain(
'bp-ass',
false,
'kinogeneva-translations/languages/'
);
}
/*
* End of file
*/