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

Core: Make contact language required information (SH-439, SH-428) #897

Merged
merged 5 commits into from
Nov 7, 2016
Merged

Core: Make contact language required information (SH-439, SH-428) #897

merged 5 commits into from
Nov 7, 2016

Conversation

Pikkupomo
Copy link
Contributor

@Pikkupomo Pikkupomo commented Nov 4, 2016

Add helpers to identify existing languages
We are relying on Babel when it comes to translations. It was,
however, possible to use languages that were extinct long time ago.
These helpers will help you identify valid languages for Shuup coding
environment.

Add LanguageFormField
Also fix issue with extinct languages by using the
newly introduced helpers in Shuup.

** Core: Start actually using Contact.language**

Core: Fix bug with order_source.language
Source language was never transferred back to Order which caused language being lost when Source was used as a base for Order.

Core: Make OrderSource.language usable
Old language was pretty much unused and the value was
only applied if the programmer knew that it should be set.

Change the functionality so that if the OrderSource
has no language set, the customers
language will be used as a language for OrderSource too.

OrderSource must have a language set, so if no valid
languages are found, source will use settings.LANGUAGE_CODE.

Also add tests to show that this change makes notification emails to
be send in proper language.

Refs SH-439, SH-428

class Migration(migrations.Migration):

dependencies = [
('shuup', '0010_update_managers'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be dependent on 11 and this migration 12.

elif self.customer:
lang = self.customer.language

if not is_existing_language(lang):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this if really needed it seems that after the customer doesn't exist the language is settings.LANGUAGE_CODE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking this too, but source.language can be set to something strange thus must be validated. imo.

@tulimaki
Copy link
Contributor

tulimaki commented Nov 7, 2016

LGTM after these few issues. Also changelog could be added since there is new things in this PR.

We are relying on Babel when it comes to translations. It was,
however, possible to use languages that were extinct long time ago.
These helpers will help you identify valid languages for Shuup coding
environment.

Refs SH-439
Also fix issue with extinct languages by using the
newly introduced helpers in Shuup.

Refs SH-439
Source language was never transferred back to Order which caused language being lost when Source was used as a base for Order.

Refs SH-439, SH-428
Old language was pretty much unused and the value was
only applied if the programmer knew that it should be set.

Change the functionality so that if the `OrderSource`
has no language set, the customers
language will be used as a language for `OrderSource` too.

`OrderSource` must have a language set, so if no valid
languages are found, source will use `settings.LANGUAGE_CODE`.

Also add tests to show that this change makes notification emails to
be send in proper language.

Refs SH-428
@tulimaki tulimaki merged commit 376a351 into shuup:master Nov 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants