Jump to content
Crowdland Technology

[SOLVED] Problem with page-names in Greek

Recommended Posts

Hello everyone.

I'm having some issues with Greek as default language, because the page name is not created automatically when enter the title of a new page. 

Any chance to add support for it?

I found this char mapping that might help on line 188

https://github.com/elpak/Greeklish-permalink-wordpress/blob/master/greeklish-permalink/greeklish-permalinks.php

Thank you!

unknown.png

 

[EDIT]: A solution

This was easier than we thought, we managed to find a solution by looking at how the sanitizer of page names works. 

This is how the URL looks with this solution:

 proof_of_concept.thumb.png.f708cca75c1806bdf88d1231bc1247b3.png

 

For ProcessWire 3+ (what we tested) find Modules > Core > InputfieldPageName and under the “Character Replacements” Field you can add the mapping you would like.


unknown.thumb.png.257b9e0d0a39f3040985351327807fbd.png

The replacement is not in the Core yet, so adding it for reference. The mapping is adjusted and simplified, and it follows the official Transliteration found here: https://en.wikipedia.org/wiki/Romanization_of_Greek
α=a
ά=a
β=b
γ=g
δ=d
ε=e
έ=e
ζ=z
η=i
ή=i
θ=th
ι=i
ί=i
κ=k
λ=l
μ=m
ν=n
ξ=x
ο=o
ό=o
π=p
ρ=r
σ=s
ς=s
τ=t
υ=y
ύ=y
ϋ=y
φ=f
χ=ch
ψ=ps
ω=o
ώ=o

Cheers to @PWaddict for also supplying an unofficial mapping and pointing us to the right direction 

@ryan It would be great if this would be added to the Core sometime in the future and we can assist with further official mappings that are not present in this simplified version.

Thank you!

Cheers,

Elissavet from CrowdLand

Edited by Crowdland Technology
Adding a solution

Share this post


Link to post
Share on other sites

Hi all, greetings!

OK another solution, adding here so I don't make the original post too long.

So it turns out our client needs, except default language as Greek, also true Greek URLs not only "Greeklish" (as Greek in ascii chars was "baptized" before the UTF-8 wide adoption, from Greek+English). 

The great thing is that @ryan took care of that as shown here https://processwire.com/blog/posts/page-name-charset-utf8/

It requires ProcessWire 3.0.12+ as explained in the article, so if you're stuck with older versions for any reason, you can use the solution on the original post.

We implemented already and it seems to work as expected on the testing server, still testing though. 

The Greek char mapping is absent from the Core still so adding here the steps we followed (retracing steps from above blog post, adding the Greek chars)

1. Add the following to your /site/config.php file.

 

$config->pageNameCharset = 'UTF8';

$config->pageNameWhitelist = '-_.abcdefghijklmnopqrstuvwxyz0123456789æåäßöüđжхцчшщюяàáâèéëêěìíïîõòóôøùúûůñçčćďĺľńňŕřšťýžабвгдеёзийклмнопрстуфыэęąśłżźαάβγδεέζηήθιίϊκλμνξοόπρσςτυύφχψώω';

2. In your .htaccess

Locate directive 16a (near the bottom of the file) and comment it out by placing a # at the beginning of the line. What we are doing here is disabling the .htaccess limit on only allowing ASCII URLs to pass through to ProcessWire.

Below the above directive (16a), you'll see directive 16b, which contains the alternative to the one you just commented out. Un-comment that directive by removing the # from the beginning of the line that it is on. This is what it looks like (minus the line wrapping): (ADDING HERE THE GREEK CHARS)

RewriteCond %{REQUEST_URI} "^/~?[-_./a-zA-Z0-9æåäßöüđжхцчшщюяàáâèéëêěìíïîõòóôøùúûůñçčćďĺľńňŕřšťýžабвгдеёзийклмнопрстуфыэęąśłżźαάβγδεέζηήθιίϊκλμνξοόπρσςτυύφχψώω]*$"

 

This is what the names and URLs look now:

greek_names_utf-8.thumb.jpg.6d49f932e245ac99488ea35120780b57.jpg

 

Cheers,

Elissavet from Crowdland

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By MoritzLost
      Sorry for the convoluted title. I have a problem with Process modules that define a custom page using the page key through getModuleInfo (as demonstrated in this excellent tutorial by @bernhard). Those pages are created automatically when the module is installed. The problem is that the title of the page only gets set in the current language. That's not a problem if the current language (language of the superuser who is installing the module) is the default language; if it isn't, the Process page is missing a title in the default language. This has the very awkward effect that a user using the backend in the default language (or any other language) will see an empty entry in the setup menu:

      This screenshot comes from my Cache Control module which includes a Process page. Now I realize the description sounds obscure, but for us it's a common setup: We a multiple bilingual sites where the default language is German and the second language is English. While the clients use the CMS in German, as a developer I prefer the English interface, so whenever I install a Process module I get this problem.
      As a module author, is there a way to handle this situation? I guess it would be possible to use post-installation hooks or create the pages manually, but I very much prefer the declarative approach. The page title is already translatable (through the __ function), but of course at the time of installation there is no translation, and as far as I'm aware it's not possible to ship translations with a module so they are used automatically. Could this situation be handled better in the core? I would prefer if the module installation process would always set the title of the Process page in the default language, instead of the language of the current user.
    • By bmacnaughton
      I am using the translation function (either $this->_() or __()) within a module that responds to AJAX API calls - there isn't really a page that is being served.
      When I supply a string with an apostrophe, e.g.,
      __('Book \'em danno') It is formatted as
      Book 'em danno  
      Is there some way to prevent output formatting when retrieving strings using the translation functions?
    • By Andreas Augustin
      Hi,
      How can I use the __('Some Words to Translate') feature in Processwire Smarty Templates like {__('Some Words to Translate in Smarty')}?
       
    • By jacknails
      Each page in processwire has a name and a title.
      When I create a new page and give it a title, the name is created automatically.
      That name creates the URL of that page.
      This works great for English sites.
      However, for international users this doesn't work as nicely.

      If I create a new page and give it a title that's not in English, then the name field is left blank and I must write a "fake" title in English.

      I work with sites in Arabic and in Hebrew and this is the biggest difficulty I see when working on non English sites with Processwire.
      Even for an experienced user, this is an annoyance every time.
      For comparison, in WordPress I can have multilingual titles and URL's out of the box.
      This is an advantage WordPress has when it comes to international users.

      I would like to see this change, and perhaps help bring this change.

      What would it take for Processwire to support multilingual URL's and page names?
      What would be the best route to achieve this?


    • By statestreet
      I'm in the process of building an internal tool using ProcessWire for my team to write and manage Agile user stories. (It actually started out as a quick prototype, but you know how things go with ProcessWire, I kept going for a few hours and suddenly had a pretty full-featured system. )
      The way we do user stories, we have a story ID, such as "OP100", and then a title, such as "As an admin, I want to upload a PDF to attach to a user's account." I have these as separate fields, with the latter being the actual page title.
      These titles can get somewhat long, however, and can change throughout the lifecycle of a user story, breaking links from Pivotal Tracker. Ideally, I'd like to just use the story ID as the name / URL, so instead of "/as-an-admin-i-want-to-upload-a-pdf-to-attach-to-a-users-account/", the page would just be "/op100/".
      Further complicating this is that the story ID is optional (since a story can start out as just a concept that turns into an actual story later). So my ideal workflow would actually be one where the title creates the URL initially, but once there is a story ID, the URL changes to that (or even better, aliases to that). 
      One more related thing I'm hoping to do is to concatenate the story ID and title in the admin. Any ideas on how to do this?
×
×
  • Create New...