Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
jquery instant translations | Event Espresso - Staging Server

Support

Home Forums Translations jquery instant translations

jquery instant translations

Posted: December 2, 2013 at 5:00 pm

Viewing 7 reply threads


Cristi Constantin

December 2, 2013 at 5:00 pm

As a last solution for the strings which don’t have a translation or cannot be translated the proper way, I am thinking to use jquery as a client-side script. I tried to search on the internet for string replacement, but I couldn’t find a valuable example.
Please advice.

Thank you.


Josh

December 2, 2013 at 5:06 pm

I would advise against using jQuery in this case. WordPress has a translation filter to allow for filtering. This way you’ll avoid having to depend on the browser having JavaScript enabled.

http://www.viper007bond.com/2011/07/13/changing-core-wordpress-strings/


Cristi Constantin

December 2, 2013 at 5:20 pm

Great! Thanks!


Cristi Constantin

December 3, 2013 at 6:00 am

What about the “Unlimited” available seats? How can I translate that server-side, without overwriting the entire function which returns this result?


Dean

  • Support Staff

December 3, 2013 at 6:18 am

Hi,

The only way I can see about gettign around this is to modify the event_list_display.php file.I will put a request in to get this added to core as then the Unlimited can be added to the language files, but basically this is what I’ve done:

event_list_display.php at line 111 it says

if ($display_reg_form == 'Y' && $externalURL == '') {
			?><p id="available_spaces-<?php echo $event_id ?>" class="spaces-available"><span class="section-title"><?php _e('Available Spaces:', 'event_espresso') ?></span> <?php echo get_number_of_attendees_reg_limit($event_id, 'available_spaces') ?></p>
			<?php
		}

I changed it to

if ($display_reg_form == 'Y' && $externalURL == '') {
			?><p id="available_spaces-<?php echo $event_id ?>" class="spaces-available"><span class="section-title"><?php _e('Available Spaces:', 'event_espresso') ?></span> <?php $x = get_number_of_attendees_reg_limit($event_id, 'available_spaces'); if ($x == "Unlimited") { echo __('Unlimited'); } else { $x; } ?></p>
			<?php
		}

Then with the script Josh mentioned above just add in Unlimited to the array and then the translation.

As mentioned I will ask to get this or something like this added to core.


Cristi Constantin

December 3, 2013 at 10:35 am

This EE php file modification is what I am trying to avoid. For this kind of situation, jQuery would be acceptable for me, or maybe some other server-side replace function, which would not put a burden on the processing power of the server, especially under high loads.
Any suggestion? Even a jQuery example, maybe?


Dean

  • Support Staff

December 4, 2013 at 6:26 am

Hi,

Well the templates can be copied over to the uploads/espresso/templates directory (in this case you need to copy event_list.php and event_list_display.php) in order to not be over written.

I have put this forward for inclusion in core already.

jQuery wise, well you could use something like this:

function replace_unlimited() {

?>

<script>
jQuery(document).ready(function($) {

var unlim = $('.spaces-available').html();

console.log(unlim);

unlim = unlim.replace("Unlimited", "wibble");

console.log(unlim);

$(".spaces-available").html(unlim);

}); //end ready function
</script>

<?php

}

add_action('wp_footer', 'replace_unlimited');


Cristi Constantin

December 4, 2013 at 7:44 am

When I was saying that I don’t want to modify EE files, I was thinking of futures changes of functionality or bug fixes that you will deliver to that php part, which will not be visible for my site, due to the personal override. In general, I consider the php override a bad idea, if it can be replaced by other approaches.

The jQuery solution worked great. However, I decided to put it directly in my theme’s js file, like this:

// translate EventEspresso text, which doesn’t have gettext __() or _e()
jQuery(document).ready(function($)
{
$(function ()
{
var unlim = $(‘.spaces-available’).html();
console.log(unlim);
unlim = unlim.replace(“Unlimited”, “Nelimitat”);
console.log(unlim);
$(“.spaces-available”).html(unlim);
})
})

Viewing 7 reply threads

The support post ‘jquery instant translations’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Post any questions about the language files, translating Event Espresso, or issues with our GlotPress site for translations here.

Status: closed

Updated by Cristi Constantin 11 years, 2 months ago ago

Topic Tags

Notifications

This topic is: resolved
Event Espresso - Staging Server