Jump to content

Language-specific letters replacement after upload


marcin
 Share

Recommended Posts

Hi,

it's kind of proposal - is it possible to replace "special" characters (e.g. ś, ć, ł,... in polish) after uploading a file? The same as in "Name" field(ł => l, ś => s, ...). Currently there are dashes, but if it works somewhere, there must be some replacement array for few languages.

Thanks, Marcin

Link to comment
Share on other sites

I'm not sure I fully understand what you are trying to do, but character encoding can be a hornets nest, especially if you are destructively transforming text. Assuming the characters are going into the database correctly, one non-destructive way would be to use a TextFormatter module to apply output formatting - something like this:

class TextformatterReplaceChars extends Textformatter {  

public static function getModuleInfo() {
	return array(
		'title' => 'Replace Characters TextFormatter',
		'version' => 100,
		'singular' => true,
		'autoload' => true,
	);
}

public function format(&$str) {
	$str = strtr($str, "äåö", "aao");
}  
}

Edit: After re-reading, I think you may mean url name/slugs? Sorry if I missed the boat with my answer.

Link to comment
Share on other sites

Currently ProcessWire only attempts translation on page names. There is some overhead with doing it, so we avoid it where possible (like with filenames). If there's more demand for doing this, or if we find ways to make it happen without extra overhead, it would certainly be a consideration down the road.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...