#21524 closed defect (bug) (invalid)
No translation in ajax file
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | 3.4.1 |
| Severity: | normal | Keywords: | |
| Cc: | me@… |
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)
comment:1
SergeyBiryukov
— 10 months ago
- Keywords reporter-feedback added
comment:2
follow-up:
↓ 7
Ninos Ego
— 10 months 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..
comment:3
follow-up:
↓ 4
markoheijnen
— 10 months ago
- Keywords close added
This is not how you want to do things. You should use the WordPress ajax handlers
comment:4
in reply to:
↑ 3
markoheijnen
— 10 months 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
comment:5
Ninos Ego
— 10 months 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
comment:6
markoheijnen
— 10 months ago
- Keywords reporter-feedback close removed
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
comment:7
in reply to:
↑ 2
SergeyBiryukov
— 10 months ago
Replying to Ninos Ego:
sure, for example in the TEMPLATE_DIRECTORY/ajax/testfile.php
My guess is that you're not calling load_theme_textdomain() in that file.
Could you provide some code to reproduce the issue?