alleyinteractive / apple-news

The Publish to Apple News plugin enables your WordPress blog content to be published to your Apple News channel.
https://wordpress.org/plugins/publish-to-apple-news/
GNU General Public License v3.0
153 stars 71 forks source link

Add language detector to stop non-English articles from publishing #1151

Open fangyizhu opened 1 month ago

fangyizhu commented 1 month ago

Description

Hi, I'm helping out Mission Local of San Francisco with their tech. First of all, really appreciate the work you put into this plugin, it helps us reach tens of thousands more readers every month.

We publish articles in English, Chinese and Spanish. We coach our reporters to hide Chinese and Spanish articles from Apple news. However, we have new reporters and interns joining frequently so very occasionally a non-English article would slip through to Apple News and some Apple News editor would have to manually pull the article down.

Is it possible to implement an automated language detector in your plugin so that it automatically hides non-English articles from Apple News? Or is it possible to at least give a warning to remind the reporters to check the "Hidden Article" option manually?

There are many open source python libraries that do this: https://stackoverflow.com/questions/39142778/how-to-determine-the-language-of-a-piece-of-text

I'm not familiar with PHP but it seems like there are existing solutions as well: https://stackoverflow.com/questions/1441562/detect-language-from-string-in-php

Use Case

Option 1: When a user publishes a non-English article (like Chinese or Spanish), the "Hidden Article" option is auto-selected.

Option 2: When a user publishes a non-English article (like Chinese or Spanish), there is a warning to remind the user to check "Hidden Article" option.

image

kevinfodness commented 1 month ago

The plugin supports multiple languages, so we don't want to automatically filter out certain languages from being published at the plugin level. However, if you want to set the value of the isHidden flag based on the language of a post, you can do that using the Automation feature, as long as the language of the post is being captured in a taxonomy somewhere (category, tag, or a custom taxonomy). You can set up an Automation rule to set the value of isHidden to true if the language term is set to Chinese or Spanish.

You can also accomplish this using one of our filters, like apple_news_skip_push to completely skip sending the post to Apple News based on the result of custom logic you write.

fangyizhu commented 1 month ago

Thanks for the response. We can work with the Automation Feature and set isHidden based on categories.

Is skip publishing available in Automation panel, or no?

mogmarsh commented 1 month ago

@fangyizhu skip publishing is not available in the Automation panel.