Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added German slugifying plugin. #145

Merged
merged 3 commits into from Mar 12, 2016
Merged

Added German slugifying plugin. #145

merged 3 commits into from Mar 12, 2016

Conversation

@felixfontein
Copy link
Contributor

felixfontein commented Mar 11, 2016

Uses Nikola's newest feature (getnikola/nikola#2284) to transform ä,ö,ü,ß to ae,oe,ue,ss for German languages.

@felixfontein
Copy link
Contributor Author

felixfontein commented Mar 11, 2016

"""Checks whether the given language name with corresponding locale needs German slugifying rules."""
if locale.split('_')[0] in {'de', 'gsw'}: # German and Allemanic German
return True
if lang in {'de', 'deutsch', 'german',

This comment has been minimized.

Copy link
@Kwpolska

Kwpolska Mar 11, 2016

Member

Where would you get all those broken strings from?

This comment has been minimized.

Copy link
@felixfontein

felixfontein Mar 12, 2016

Author Contributor

I removed 'deutsch' and 'german'. I left the others as I don't know of another way to distinguish between different german locales.

if _needs_german_slugifying_rules(lang, loc):
self.german_languages.add(lang)
if len(self.german_languages) > 0:
utils.LOGGER.info("Using German slugifying rules for the following languages: {0}".format(', '.join(sorted(self.german_languages))))

This comment has been minimized.

Copy link
@Kwpolska

Kwpolska Mar 11, 2016

Member

.debug()

This comment has been minimized.

Copy link
@felixfontein

felixfontein Mar 12, 2016

Author Contributor

Good point. Not everyone likes my plugin as noisy as me ;-)

if lang is not None and lang in self.german_languages:
if not isinstance(value, utils.unicode_str):
raise ValueError("Not a unicode object: {0}".format(value))
value = value.replace('ä', 'ae').replace('ö', 'oe').replace('ü', 'ue').replace('ß', 'ss')

This comment has been minimized.

Copy link
@Kwpolska

Kwpolska Mar 11, 2016

Member

ß is handled by old_slugify properly.

This comment has been minimized.

Copy link
@felixfontein

felixfontein Mar 12, 2016

Author Contributor

I know, I only added it for sake of completeness.

Kwpolska added a commit that referenced this pull request Mar 12, 2016
Added German slugifying plugin.
@Kwpolska Kwpolska merged commit 4d45ff6 into master Mar 12, 2016
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@Kwpolska Kwpolska deleted the german-umlauts branch Mar 12, 2016
@felixfontein
Copy link
Contributor Author

felixfontein commented Mar 12, 2016

Thanks for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.