[gimp-web/gimp-web-static] Fixing translation paths. I can't believe that hack worked...



commit 46b527739ff1b0beb9f1666be32683f1beeb22a0
Author: Pat David <patdavid gmail com>
Date:   Fri Aug 21 17:18:32 2015 -0500

    Fixing translation paths.  I can't believe that hack worked...

 content/about/irc.de.md                    |    9 ----
 content/about/meta/index.fr.md             |    5 ++-
 content/about/meta/index.md                |    1 +
 content/about/meta/translating.fr.md       |   65 +++++++++++++++++++++++++
 content/about/meta/translating.md          |   73 ++++++++++++++++++++++++++++
 pelicanconf.py                             |    3 -
 plugins/mimic_hierarchy/mimic_hierarchy.py |   20 +++++++-
 themes/newgimp/static/css/gimp.css         |    4 ++
 themes/newgimp/static/css/home.css         |   10 ++++
 themes/newgimp/templates/home.html         |    9 ++-
 10 files changed, 181 insertions(+), 18 deletions(-)
---
diff --git a/content/about/meta/index.fr.md b/content/about/meta/index.fr.md
index 6d190ec..b6c4d0a 100644
--- a/content/about/meta/index.fr.md
+++ b/content/about/meta/index.fr.md
@@ -4,6 +4,7 @@ Modified: 2015-08-10T14:53:46-05:00
 Author: Pat David
 Summary: A page about the new site.
 lang: fr
+url: about/meta/
 
 
 I (Pat David) am creating this page to keep notes and information for building/maintaining the new site.
@@ -13,6 +14,8 @@ I (Pat David) am creating this page to keep notes and information for building/m
 * [To Do](./to-do/)
 * [Using Pelican](./using-pelican/)
 * [Markdown Cheatsheet](./markdown.html)
+* [Edit the Front Page]({filename}./frontpage.md)
+* [Translations]({filename}./translating.fr.md)
 
 Le travail que je fais ici est basée sur un couple de suggestions de la dernière année (ou plus, je suis 
sûr) pour actualiser la conception de WGO. En particulier, je l'avais créé une brève maquette pour montrer et 
ai été d'utiliser cela comme une sorte de guide visuel pour approcher la page principale. Vous pouvez voir 
que maquette .PNG ici (~ 1.8MB), ou un petit aperçu:
 
@@ -148,7 +151,7 @@ Further notes on using Pelican can be found on the page [Using Pelican](./using-
 ## Who
 
 <figure>
-<img src="{attach}fluffle-puff.jpg" alt='Fluffle Puff'>
+<img src="{filename}fluffle-puff.jpg" alt='Fluffle Puff'>
 <figcaption>
 This is not superfluous, it's a test of local image linking from this directory.
 </figcaption>
diff --git a/content/about/meta/index.md b/content/about/meta/index.md
index 3dae768..91cef4d 100644
--- a/content/about/meta/index.md
+++ b/content/about/meta/index.md
@@ -14,6 +14,7 @@ I (Pat David) am creating this page to keep notes and information for building/m
 * [Using Pelican](./using-pelican/)
 * [Markdown Cheatsheet](./markdown.html)
 * [Edit the Front Page]({filename}./frontpage.md)
+* [Translations]({filename}./translating.md)
 
 The work I am doing here is based on a couple of suggestions over the past year (or more, I'm sure) to 
refresh the design of WGO.
 In particular, I had created a brief mockup to show and have been using that as a sort of visual guide for 
approaching the main page.
diff --git a/content/about/meta/translating.fr.md b/content/about/meta/translating.fr.md
new file mode 100644
index 0000000..b54b900
--- /dev/null
+++ b/content/about/meta/translating.fr.md
@@ -0,0 +1,65 @@
+Title: Translations (i18n)
+Date: 2015-08-21T11:45:47-05:00
+Author: Pat David
+lang: fr 
+
+Pelican avait déjà une belle simple support pour la traduction des pages et des articles.
+
+Pour faire une traduction, il suffit de créer un autre fichier avec le fichier de base. Tant que le *slug* 
serait le même, un fichier serait considérée comme une traduction de l'autre. Définition de l'attribut `lang` 
dans les métadonnées du fichier signalerait ce type de fichier, il est.
+<small>
+La limace est actuellement généré à partir du titre de la page dans les métadonnées.
+</small>
+
+A titre d'exemple, ce fichier est:
+
+    content/about/meta/translating.md
+
+Et les métadonnées au sommet de ce fichier ressemble à ceci:
+
+    Title: Translations (i18n)
+    Date: 2015-08-21T11:45:47-05:00
+    Author: Pat David
+    lang: en
+
+Pour créer une version traduite de cette page, nous aimerions créer un nouveau fichier:
+
+    content/about/meta/translating.fr.md
+
+Les métadonnées serait un peu différente, en ce que l'attribut `lang` serait différent maintenant:
+
+
+    Title: Translations (i18n)
+    Date: 2015-08-21T11:45:47-05:00
+    Author: Pat David
+    lang: fr
+
+Sinon tout le reste pourrait rester le même.
+
+En faisant cela, Pelican va maintenant automatiquement la liste de la traduction (s) étant disponible (par 
défaut il est répertorié juste sous le titre). Il serait généralement ressembler à ceci (pour une traduction 
française étant disponibles):
+
+    Translations: fr
+
+
+## i18n_subsites
+
+Avec la mise en œuvre de i18n_subsites, le comportement est essentiellement le même.
+
+La différence est maintenant que d'un sous-site entièrement nouveau est construit. Le site avec les 
anciennes traductions servirait une page traduite, mais ce serait une page statique simple.
+
+Cela signifie que tous les liens hors de la page à d'autres contenus souhaitez-vous apporter à la langue par 
défaut (en) à nouveau. Si cette page avait une traduction, et que vous vouliez le voir, vous devez cliquer 
sur l'option de traduction appropriée nouveau.
+
+L'option de traduction d'une seule page ne dispose d'aucun mécanisme pour traduire les modèles aussi bien 
(juste le contenu de la page).
+
+Mise en œuvre du plugin i18n_subsites permet désormais un sous-ensemble du site qui sera construit sur la 
base de l'option de langue. Donc, en cliquant sur une traduction de langue pour une page va maintenant mettre 
l'utilisateur au sous-site correspondant.
+
+Ce sont les sous-sites qui se créés par exemple:
+
+    gimp.org/fr/about/...
+    gimp.org/de/about/...
+
+Et ainsi de suite pour chaque traduction.
+
+
+### Fallback
+
+Une fonctionnalité intéressante du plugin i18n_subsites est que les pages qui sont liées, mais le manque 
d'une traduction, seront toujours montrer la version **en** comme solution de repli.
diff --git a/content/about/meta/translating.md b/content/about/meta/translating.md
new file mode 100644
index 0000000..43766de
--- /dev/null
+++ b/content/about/meta/translating.md
@@ -0,0 +1,73 @@
+Title: Translations (i18n)
+Date: 2015-08-21T11:45:47-05:00
+Author: Pat David
+lang: en
+
+Pelican already had a nice simple support for translating pages and articles.
+
+To do a translation, simply create another file alongside the base file.
+As long as the *slug* would be the same, one file would be considered a translation of the other.
+Setting the `lang` attribute in the file metadata would signal what type of file it is.
+
+<small>
+The *slug* is currently generated from the page title in the metadata.
+</small>
+
+As an example, this file is:
+
+    content/about/meta/translating.md
+
+And the metadata at the top of this file looks like this:
+
+    Title: Translations (i18n)
+    Date: 2015-08-21T11:45:47-05:00
+    Author: Pat David
+    lang: en
+
+To create a translated version of this page, we would create a new file:
+
+    content/about/meta/translating.fr.md
+
+The metadata would look slightly different, in that the `lang` attribute would be different now:
+
+
+    Title: Translations (i18n)
+    Date: 2015-08-21T11:45:47-05:00
+    Author: Pat David
+    lang: fr
+
+Otherwise everything else could stay the same.
+
+When doing this, Pelican will now automatically list the translation(s) being available
+(by default it is listed just under the title).
+It would typically look like this (for a French translation being available):
+
+    Translations: fr
+
+
+## i18n_subsites
+
+With the implementation of i18n_subsites, the behavior is mostly the same.
+
+The difference now is that an entirely new sub-site is built.
+The site with the old translations would serve a translated page, but it would be a simple static page.
+
+This means that any links off the page to other content would bring you to the default language (en) again.
+*If* that page had a translation, and you wanted to see it, you would have to click on the appropriate 
translation option again.
+
+The single-page translation option doesn't have any mechanism for translating the templates as well (just 
the page content).
+
+Implementation of the i18n_subsites plugin now allows an entire sub-site to be built based on the language 
option.
+So clicking on a language translation for a page will now bring the user to the corresponding sub-site.
+
+These are the sub-sites that get created for example:
+
+    gimp.org/fr/about/...
+    gimp.org/de/about/...
+
+And so on for each translation.
+
+
+### Fallback
+
+A nice feature of the i18n_subsites plugin is that pages that are linked, but lack a translation, will still 
show the **en** version as a fallback.
diff --git a/pelicanconf.py b/pelicanconf.py
index f70fc36..a41e208 100644
--- a/pelicanconf.py
+++ b/pelicanconf.py
@@ -12,9 +12,6 @@ I18N_SUBSITES = {
         'fr': {
             'SITENAME': 'GIMP FR',
             },
-        'de': {
-            'SITENAME': 'GIMP DE',
-            }
         }
 
 AUTHOR = u'Pat David'
diff --git a/plugins/mimic_hierarchy/mimic_hierarchy.py b/plugins/mimic_hierarchy/mimic_hierarchy.py
index 38cc99c..88479be 100644
--- a/plugins/mimic_hierarchy/mimic_hierarchy.py
+++ b/plugins/mimic_hierarchy/mimic_hierarchy.py
@@ -59,20 +59,34 @@ def mimic_page_hierarchy(content_object):
         # We override the slug to include the path up to the filename
         metadata['slug'] = os.path.join(path, page.slug)
 
+
         metadata['filename'] = os.path.split(page.get_relative_source_path())[1]
         metadata['filename'] = os.path.splitext( metadata['filename'])[0] + '.html'
 
+        # PLD: This is a stupid hack.
+        # I'm basically stripping the 'fr.' off of
+        # translation files, and letting the i18n_subsite engine
+        # take care of things from here.  I hope nobody reads this...
+        fn = metadata['filename']
+        metadata['filename'] = fn.replace('fr.', '')
+
+
+        print("#### filename: " + metadata['filename'] )
+        if 'index' in metadata['filename'] and 'about/meta' in metadata['slug']:
+            print('slug: ' + metadata['slug'] + '  filename: ' + metadata['filename'] )
+
         # PLD: this is my doing, sorry...
         # ok, if path is empty, use page.slug
         # if path is not empty, use path
         # still need to test if lang works properly after this
         if path:
-            #print( "got path: " + path )
+            #print( "path: " + path )
             metadata['slug'] = path
         else:
             #print( "path empty! " + page.slug )
             metadata['slug'] = page.slug
 
+
         if metadata['filename'] != 'index.html':
             setattr(page, 'override_url', metadata['slug'] +'/'+ metadata['filename'] )
             if hasattr( page, 'save_as' ) and key == 'save_as':
@@ -92,7 +106,9 @@ def mimic_page_hierarchy(content_object):
         # We have to account for non-default language and format either,
         # e.g., PAGE_SAVE_AS or PAGE_LANG_SAVE_AS
         infix = '' if in_default_lang(page) else 'LANG_'
-        #print( "RETURNING: " + page.settings['PAGE_' + infix + key.upper()].format(**metadata) )
+        if 'index' in metadata['filename'] and 'about/meta' in metadata['slug']:
+            print( "infix: " + infix + " key: " + key.upper() )
+            print( "RETURNING: " + page.settings['PAGE_' + infix + key.upper()].format(**metadata) )
         return page.settings['PAGE_' + infix + key.upper()].format(**metadata)
 
 
diff --git a/themes/newgimp/static/css/gimp.css b/themes/newgimp/static/css/gimp.css
index f7edb3d..c770168 100644
--- a/themes/newgimp/static/css/gimp.css
+++ b/themes/newgimp/static/css/gimp.css
@@ -236,6 +236,10 @@ footer .nav-bottom a {
     font-size: 0.85rem;
 }
 
+.row.bottom a {
+    color: #f57900;
+}
+
 #nav-btm-gimp-home {
     margin-left: -1.65rem;
 }
diff --git a/themes/newgimp/static/css/home.css b/themes/newgimp/static/css/home.css
index eb8d020..9faf17a 100644
--- a/themes/newgimp/static/css/home.css
+++ b/themes/newgimp/static/css/home.css
@@ -10,6 +10,7 @@ p {
             */
 }
 
+
 #banner {
     min-height: 350px;
     background-image: linear-gradient(rgba(44,52,80,0.5), rgba(44,62,80,0.5)), 
url('/theme/images/cotton.jpg');
@@ -26,6 +27,7 @@ p {
 
 #banner .intro {
     margin: 2rem 0;
+    margin: 0.5rem 0;
 }
 
 #banner .intro img {
@@ -206,3 +208,11 @@ span#gFirst {
 
 @media (min-width: 64rem) {
 }
+
+ media (max-width: 40rem) {
+    #banner .intro img {
+        height: 120px;
+        width: auto;
+    }
+
+}
diff --git a/themes/newgimp/templates/home.html b/themes/newgimp/templates/home.html
index ffca13a..866ae51 100644
--- a/themes/newgimp/templates/home.html
+++ b/themes/newgimp/templates/home.html
@@ -1,6 +1,6 @@
 {% extends "base.html" %}
 
-{% block title %}{{ SITENAME }} - The GNU Image Manipulation Program{% endblock %}
+{% block title %}{{ SITENAME }} - GNU Image Manipulation Program{% endblock %}
 
 {% block head %}
 {{ super() }}
@@ -44,7 +44,10 @@
                     <h2>The Free &amp; Open Source Image Editor</h2>
                     {# <h2>This is the official GIMP website</h2> #}
                     <p>
-                        This is the official GIMP website.
+                        This is the official GIMP website.<br/>
+                        <strong>GIMP</strong> is an acronym for <strong>GNU Image Manipulation 
Program</strong>.
+                        It is the Free and Open Source, cross platform image editor available for
+                        GNU/Linux, OS X, Windows and more.
                         It contains information about downloading, installing, using, and enhancing it. 
                         This site also serves as a distribution point for the latest releases. 
                         We try to provide as much information about the GIMP community and related projects 
as possible.
@@ -79,7 +82,7 @@
                     <h3>High Quality Photo Manipulation</h3>
                     <p>
                         GIMP provides the tools for needed for high quality image manipulation.
-                        From retouching to creative composites, the only limit is your imagination.
+                        From retouching to restoring to creative composites, the only limit is your 
imagination.
                     </p>
                 </div>
             </div>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]