First, you have nasty typo in __contsruct
. 🙂
Second, your hook timing is wrong. Related WP JavaScript is localized via postL10n
object (you can see it echoed in page’s source), that gets put together on init
hook – way earlier then admin_head
and your filter is not in place yet.
From quick test this should do it:
add_action( 'init', array ( &$this, 'load_gettext_filters' ), 9 );
Update
Ok, scratch that. Won’t work if we need context. Let’s try this:
add_action('admin_footer', array ( &$this, 'localize_post_script' ) );
function localize_post_script() {
global $wp_scripts;
$wp_scripts->registered['post']->extra['l10n'][1]['publish'] = __('Publish');
}
Related Posts:
- How to load translation in JavaScript?
- How to set translations in javascripts for my plugin?
- Cannot set property InnerHTML of null [duplicate]
- How can I submit a form using JavaScript?
- How do I get the current date in JavaScript?
- How to do a redirect to another route with react-router?
- Jest spy on functionality
- Use a JSON array with objects with javascript
- Toggle show/hide on click with jQuery
- JavaScript string newline character?
- How to create a GUID / UUID
- How does “/\s/g” replace spaces with other characters?
- What is the correct way to check for string equality in JavaScript?
- JavaScript TypeError: Cannot read property ‘style’ of null
- How to obtain username from Promise
? - How do you check if a variable is an array in JavaScript?
- Static variables in JavaScript
- ReferenceError : window is not defined at object.
Node.js - Node.js Port 3000 already in use but it actually isn’t?
- Uncaught TypeError: $.post is not a function
- Unable to verify leaf signature
- When and why to ‘return false’ in JavaScript?
- In angularjs we are having ng-disabled directive, why ng-enabled directive is not provided by the framework as we are having ng-show and ng-hide
- Send POST data using XMLHttpRequest
- TypeError: app.use() requires middleware functions
- Possible to extend types in Typescript?
- JavaScript enumerator?
- How to format numbers as currency strings
- Understanding how data-dismiss attribute works in Bootstrap
- Add table row in jQuery
- Node.js document is not defined
- Create table with jQuery – append
- When is JavaScript synchronous?
- How to reset a form using jQuery with .reset() method
- Npm install cannot find module ‘semver’
- How to download a file with Node.js (without using third-party libraries)?
- Getting current date and time in JavaScript
- What is ViewChild in Angular2?
- Permutations in JavaScript?
- How do I remove documents using Node.js Mongoose?
- node-request – Getting error “SSL23_GET_SERVER_HELLO:unknown protocol”
- Count the number of occurrences of a character in a string in Javascript
- Javascript removeEventListener not working
- jQuery make global variable
- Mixed Content Page: requested an insecure stylesheet error
- How to do integer division in javascript (Getting division answer in int not float)?
- javascript unexpected identifier
- How to send email by using javascript or jquery
- Access to Image from origin ‘null’ has been blocked by CORS policy
- Onclick on bootstrap button
- TypeError: res.json is not a function
- How to do case insensitive string comparison?
- Understanding the ngRepeat ‘track by’ expression
- Don’t make functions within a loop [duplicate]
- Difference between ?:, ?! and ?=
- JavaScript post request like a form submit
- Jest encountered an unexpected token
- How to get the first element of an array?
- replace space with dash JavaScript
- Using “×” word in html changes to ×
- How do I store an array in localStorage?
- How to check if the URL contains a given string?
- How to enable CORS in AngularJs
- bootstrap buttons onclick events
- Cannot read property ‘forEach’ of undefined
- DeprecationWarning: Calling an asynchronous function without callback is deprecated. – how to find where the “function:” is?
- What are the benefits of using wp_enqueue_script?
- What type of template are WP media-modal’s templates?
- Eliminate render blocking javascript
- is_front_page() not working
- The value of attribute [ data-type ] must be in double quotes – custom html widget error
- How to replace a javascript select box onchange event to a form submit action?
- Add tinymce dynamically via Javascript
- Sending custom data with Media Frame Model
- How to Add Javascript Only When a Function Exists?
- Make TinyMCE checkbox that returns a value instead of true/false
- TypeError: window.tinyMCE.execInstanceCommand is not a function
- Adding JavaScript to a WordPress website
- wp-env mysqlcheck error:1130
- event/callback on block update?
- How to disable inline css styles generated by Gutenberg editor?
- Multiple Conditional Controllers
- Adding javascript trigger to user role selection on the user-edit page
- Vue and wordpress.Bad Request ajax request
- How to add if lt IE9 conditional scripts to functions.php
- How to include a JSON file on my page?
- Adding inline JavaScript after wp_enqueue_scripts
- How to add “on change” to a text input in contact form7?
- Update media library attachments
- JavaScript Libraries in WordPress
- How to use WP switchEditors.switchto(this) JS function in your own script?
- Landing function through URL
- Escaping quotes while enqueuing scripts
- Combining results from WP-API using AngularJS
- dropdown does not work [closed]
- Anyway to disable the auto excerpt creation?
- How do I cycle a JS function in WordPress? [closed]
- WP REST API – “rest_user_cannot_view” ONLY on specific users
- Uncaught ReferenceError: tippy is not defined
- How to add a new attribute to core wp block editor without npm?