Diphthongs like in German or Swedish are not transliterated correctly

Created on 17 June 2016, almost 9 years ago
Updated 29 June 2023, almost 2 years ago

If one tries to transliterate paths from entity fields (for example taxonomy) characters like Γ€, ΓΌ, ΓΆ are converted to a,u,o but not to ae, ue, oe. The Drupal 8 transliteration does that correctly on url-paths but for file uploads File (Field) Paths creates just a, u, o. - It would be great to have that feature for SEO and useful paths on the server.

The Problem is that the pathauto module is used to transliterate the path before File (Field) Paths does it. The code at the end of the module (/modules/filefield_paths/filefield_paths.module) should be changed in that manner:

// Transliterate string
    if ($transliterate == TRUE) {
// Use the current default interface language.
$langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
// Instantiate the transliteration class.
$trans = \Drupal::transliteration();
// Use this to transliterate some text.
$path = $trans->transliterate($path, $langcode);     
    }

Moreover the Operation should be done before the path and the filename is cleared by the pathauto module:

before this

$path = \Drupal::service('pathauto.alias_cleaner')
            ->cleanstring($path);
          if (!empty($pathinfo['extension'])) {
            $path .= '.' . \Drupal::service('pathauto.alias_cleaner')
                ->cleanstring($pathinfo['extension']);
          }
          $path = str_replace('/', '', $path);
        }
        else {
           
          $path = str_replace($pathinfo['filename'], \Drupal::service('pathauto.alias_cleaner')
            ->cleanstring($pathinfo['filename']), $path);
        }
      }

and before that

$path = \Drupal::service('pathauto.alias_cleaner')->cleanstring($path);
      }
    }
    elseif ($remove_slashes) {
      $path = str_replace('/', '', $path);
    }
πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany cmsarnold

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Needs work almost 2 years ago
  • πŸ‡©πŸ‡ͺGermany c-logemann Frankfurt/M, Germany

    Patch needs to be relative to module folder not the complete installation path/website project as currently in #5 patch: "/web/modules/contrib/filefield_paths/"

Production build 0.71.5 2024