From fc9ca8552589db37ecbb628fc0eed56eef09e1cd Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Fri, 3 Aug 2018 00:03:42 -0500 Subject: [PATCH] Add logic for and translation plug. --- posts/newsletter/1/post.md | 2 ++ posts/newsletter/2/post.md | 2 ++ posts/newsletter/3/post.md | 2 ++ posts/newsletter/4/post.md | 2 ++ posts/newsletter/5/post.md | 2 ++ posts/newsletter/6/post.md | 2 ++ posts/newsletter/7/post.md | 2 ++ posts/newsletter/8/post.md | 2 +- posts/release/lubuntu-16.04.5/post.md | 3 ++- update-post | 21 ++++++++++++++++++++- 10 files changed, 37 insertions(+), 3 deletions(-) diff --git a/posts/newsletter/1/post.md b/posts/newsletter/1/post.md index d761062..8946b5a 100644 --- a/posts/newsletter/1/post.md +++ b/posts/newsletter/1/post.md @@ -1,5 +1,7 @@ At Lubuntu we decided it was a good idea to create a weekly newsletter detailing the work that has been happening. So, here we are. :) +NOTICE + # Changes ## General diff --git a/posts/newsletter/2/post.md b/posts/newsletter/2/post.md index bff990c..db11381 100644 --- a/posts/newsletter/2/post.md +++ b/posts/newsletter/2/post.md @@ -1,5 +1,7 @@ Here is the second issue of This Week in Lubuntu Development. You can read last week's issue [here](https://lubuntu.me/this-week-in-lubuntu-development-1/). +NOTICE + # Changes ## General diff --git a/posts/newsletter/3/post.md b/posts/newsletter/3/post.md index 2402782..1b80de8 100644 --- a/posts/newsletter/3/post.md +++ b/posts/newsletter/3/post.md @@ -1,5 +1,7 @@ Here is the third issue of This Week in Lubuntu Development. You can read last week's issue [here](https://lubuntu.me/this-week-in-lubuntu-development-2/). +NOTICE + # Changes ## General diff --git a/posts/newsletter/4/post.md b/posts/newsletter/4/post.md index b2c9efa..290d201 100644 --- a/posts/newsletter/4/post.md +++ b/posts/newsletter/4/post.md @@ -1,5 +1,7 @@ Here is the fourth issue of This Week in Lubuntu Development. You can read last week's issue [here](https://lubuntu.me/this-week-in-lubuntu-development-3/). +NOTICE + # Changes ## General diff --git a/posts/newsletter/5/post.md b/posts/newsletter/5/post.md index 23bbc85..1455489 100644 --- a/posts/newsletter/5/post.md +++ b/posts/newsletter/5/post.md @@ -1,5 +1,7 @@ Here is the fifth issue of This Week in Lubuntu Development. You can read the previous issue [here](https://lubuntu.me/this-week-in-lubuntu-development-4/). +NOTICE + # Changes ## General diff --git a/posts/newsletter/6/post.md b/posts/newsletter/6/post.md index 45dc18a..04a7772 100644 --- a/posts/newsletter/6/post.md +++ b/posts/newsletter/6/post.md @@ -1,5 +1,7 @@ Here is the sixth issue of This Week in Lubuntu Development. You can read the last issue [here](https://lubuntu.me/this-week-in-lubuntu-development-5/). +NOTICE + # Changes ## Lubuntu 17.10 reaches End of Life on July 19, 2018 diff --git a/posts/newsletter/7/post.md b/posts/newsletter/7/post.md index d2e4c98..bc075d0 100644 --- a/posts/newsletter/7/post.md +++ b/posts/newsletter/7/post.md @@ -1,5 +1,7 @@ Here is the seventh issue of This Week in Lubuntu Development. You can read the last issue [here](https://lubuntu.me/this-week-in-lubuntu-development-6/). +NOTICE + # Changes ## General diff --git a/posts/newsletter/8/post.md b/posts/newsletter/8/post.md index 9514398..037ac47 100644 --- a/posts/newsletter/8/post.md +++ b/posts/newsletter/8/post.md @@ -1,6 +1,6 @@ Here is the eighth issue of This Week in Lubuntu Development. You can read the last issue [here](https://lubuntu.me/this-week-in-lubuntu-development-7/). - +NOTICE # Changes diff --git a/posts/release/lubuntu-16.04.5/post.md b/posts/release/lubuntu-16.04.5/post.md index 90971f8..bced786 100644 --- a/posts/release/lubuntu-16.04.5/post.md +++ b/posts/release/lubuntu-16.04.5/post.md @@ -1,6 +1,7 @@ Thanks to all the hard work from our contributors, we are pleased to announce that Lubuntu 16.04.5 LTS has been released! - +NOTICE + # What is Lubuntu? Lubuntu is an official Ubuntu flavor which uses the Lightweight X11 Desktop Environment (LXDE). The project’s goal is to provide a lightweight yet functional Linux distribution based on a rock solid Ubuntu base. Lubuntu specifically targets older machines with lower resources, but also runs great on newer hardware. Along with a simple but usable graphical user interface, Lubuntu comes with a wide variety of applications chosen for their small footprint so you can browse, email, chat, play, and be productive. diff --git a/update-post b/update-post index d1cea4d..b549d45 100755 --- a/update-post +++ b/update-post @@ -19,6 +19,7 @@ import sys import yaml from os import path +from babel import Locale from markdown import markdown from wordpress_xmlrpc import Client from wordpress_xmlrpc.methods import posts @@ -68,6 +69,24 @@ def updatepost(infoyaml, md, post=None, title=None, slug=None): title = title.replace("POUND", "#") + if "l10n" in infoyaml: + l10nstr = "" + for lang in infoyaml["l10n"]: + try: + locale = Locale(lang) + except: + break + langname = locale.display_name + if l10nstr != "": + l10nstr = l10nstr + ", " + else: + l10nstr = "Translated into: " + l10nstr = l10nstr + "" + langname + "" + md = md.replace("NOTICE", "\n\n" + l10nstr) + else: + md = md.replace("NOTICE", "") + + print(md) post.title = title post.content = md post.post_status = "publish" @@ -80,7 +99,7 @@ def updatepost(infoyaml, md, post=None, title=None, slug=None): post.terms = tags - wp.call(posts.EditPost(post.id, post)) + #wp.call(posts.EditPost(post.id, post)) def main(): posts = loadposts()