Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Special language tag to retrieve raw (i.e. untranslated) text #133

Closed
Blue3agle opened this issue Apr 16, 2015 · 5 comments

Comments

@Blue3agle
Copy link

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.

@johnclause
Copy link
Member

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?

@johnclause
Copy link
Member

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.

@Blue3agle
Copy link
Author

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.

@johnclause
Copy link
Member

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?

@johnclause
Copy link
Member

This is probably ready to be closed? We can still write into a closed issue and may re-open it if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants