#21524 closed defect (bug) (invalid)
No translation in ajax file
Reported by: | Ninos Ego | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.4.1 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
I've got some ajax files in my theme. In that I have included the wp-blog-header.php and written for correct access:
header("HTTP/1.1 200 OK");
All works perfect, also the own defined functions of my theme. But with the translation I've got a problem. My outputs are not translated in the used language. These remain the same. I've used the language functions
_e(), __(), _n(), sprintf()
correctly.
Think that's a bug..
Change History (8)
#2
follow-up:
↓ 7
@
12 years ago
sure, for example in the TEMPLATE_DIRECTORY/ajax/testfile.php
<?php require_once('../../../../wp-blog-header.php'); header("HTTP/1.1 200 OK"); _e('Translate!', 'PARAMETER'); ?>
In the .po and .mo file the string is translated, also I get an translated output by copying this line into the function or somewhere else. Only the ajax files put the original string out..
#3
follow-up:
↓ 4
@
12 years ago
- Keywords close added
This is not how you want to do things. You should use the WordPress ajax handlers
#4
in reply to:
↑ 3
@
12 years ago
Replying to markoheijnen:
This is not how you want to do things. You should use the WordPress ajax handlers. See http://codex.wordpress.org/AJAX_in_Plugins
#5
@
12 years ago
But why it's not possible in this way, because all other things are working perfectly..Also I think it's a bug, if you want to include wordpress in other boards. Then you have to do this kind of way by including the wp-blog-header.php
#6
@
12 years ago
- Keywords reporter-feedback close removed
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
I tested it and it works. It seems you do something wrong. I did tested it with the default WordPress language file but it should work with custom ones.
Also you should use WordPress AJAX handlers and not like this. Using wp-blog-header.php is in my opinion always wrong.
Could you provide some code to reproduce the issue?