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

Projects
None yet
2 participants
@Blue3agle
Copy link

Blue3agle commented Apr 16, 2015

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

This comment has been minimized.

Copy link
Member

johnclause commented Apr 17, 2015

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

This comment has been minimized.

Copy link
Member

johnclause commented Apr 23, 2015

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

This comment has been minimized.

Copy link
Author

Blue3agle commented Apr 27, 2015

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

This comment has been minimized.

Copy link
Member

johnclause commented Apr 27, 2015

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

This comment has been minimized.

Copy link
Member

johnclause commented Apr 30, 2015

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
You can’t perform that action at this time.