Feature request: Special language tag to retrieve raw (i.e. untranslated) text
Blue3agle opened this issue · 5 comments
Originally posted here: https://wordpress.org/support/topic/special-tag-to-get-raw-untranslated-text
Let me first explain the usage scenario:
I am setting up a WordPress Network for a sports club with 38 groups. Each group will have their site in the network, and will post news English and Norwegian. The main site will be a portal, and the news feed here should aggregate the news from the group sites.
The challenge:
I use Feed Pull to pull the content from the group pages. However this needs me to specify the link to each site's feed including the language tag (http://subgroup.domain.tld//feed). This will however only give one language.
Suggested solution:
Create a special "language" tag called "raw" or "all" that gives the untranslated content with language tags and all. (Example: [:no]Overskrift[:en]Heading[:])
This would allow me to put the posts directly into the front site and have translations work. The only requisite for this to work is that the main site has activated support for all languages that the sub groups may use.
I am not sure if this should be available for any page and post, or just for the news feed... I see no harm in having it available for all page types, but it should not be selectable from the language switcher, as it would look weird and not be friendly to human readers.
Example:
If I go to http://example.com/no/feed/ I would get content like
Title: Dette er en fin post
Content: Denne fine posten er på norsk
If I go to http://example.com/en/feed I would get content like
Title: This is a nice post
Content: This nice post is in English
If I go to http://example.com/raw/feed I would get content like
Title: [:no]Dette er en fin post[:en]This is a nice post[:]
Content: [:no]Denne fine posten er på norsk[:en]This nice post is in English[:]
This will allow me to import the news feed http://example.com/raw/feed to a site that uses qTranslate and just plug it in to a new post and qTranslate will then show the right content in either Norwegian or English.
It is indeed a good idea, which we should implement, but I am not sure on the priority of it. Can you read PHP code? Would you be able to implement it and submit pull request here? We will need to finalize the details. Since the language code is essentially designed to be two-letter, it will be a bit challenging to use three-letter special code 'raw'. I am afraid it will generate too many additional 'if' statements. Maybe it would be better to use a special query argument?
Could you please try the latest version https://github.com/qTranslate-Team/qtranslate-x/archive/3.2.9.9.5.zip? Use query argument 'qtranslate-mode=raw' to retrieve untranslated pages.
Hello.
This worked excellently. It grabbed the raw text and put it into the post on the main page. Now all languages used on our sub pages will show correctly on the main page.
I had to use http://example.com/feed/?qtranslate-mode=raw without the prepath (http://example.com/en/feed/?qtranslate-mode=raw) to get it to work properly, though. So it would be good if you could ignore path (and probably domain) prefixes when qtranslate-mode=raw.
Thank you for this quick fix.
Yes, it is designed for bare urls. I thought it is good enough, why would you encode url with language if you get raw content anyway?
This is probably ready to be closed? We can still write into a closed issue and may re-open it if needed.