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

feat: Multilanguage sites: language selector only will show "enabled" languages and language default always will be System default #17745

Conversation

developmentforpeople
Copy link
Contributor

@developmentforpeople developmentforpeople commented Aug 7, 2022

If you need a multilangual site, but only some languages being available and you need to define one language as default.

Solves:

  • Only some languages can be selected as "available" for websites ("Language" > Disable the ones you want to hide). It affects: frontend language selector, and all methods using "frappe.translate.get_all_languages"
  • Default language will be the one defined into "Website Settings". It affects everything using "frappe.translate.get_language"

How:

  • Doctype "Language" field "enabled" is used as filter for frontend language selector. So only "enabled" languages will be used for the whole website (get_all_languages get only enabled ones).
  • frappe.translate.get_language will use the same logic as now, but as last option, it will use the System default language or "en".

no-docs

@developmentforpeople developmentforpeople requested a review from a team as a code owner August 7, 2022 09:35
@developmentforpeople developmentforpeople requested review from surajshetty3416 and removed request for a team August 7, 2022 09:35
@github-actions github-actions bot added the add-test-cases Add test case to validate fix or enhancement label Aug 7, 2022
@codecov
Copy link

codecov bot commented Aug 7, 2022

Codecov Report

Merging #17745 (518acf7) into version-14-hotfix (6c8b789) will decrease coverage by 0.02%.
The diff coverage is 84.45%.

@@                  Coverage Diff                  @@
##           version-14-hotfix   #17745      +/-   ##
=====================================================
- Coverage              56.15%   56.13%   -0.03%     
=====================================================
  Files                    752      752              
  Lines                  68019    68133     +114     
  Branches                5869     5869              
=====================================================
+ Hits                   38195    38244      +49     
- Misses                 26220    26285      +65     
  Partials                3604     3604              
Flag Coverage Δ
server 61.86% <85.81%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@ankush ankush added the backport develop port port to develop branch label Aug 8, 2022
@ankush
Copy link
Member

ankush commented Aug 8, 2022

This seems to be a decent solution to the problem mentioned before:

@surajshetty3416 is there any way to limit the languages shown? For example, I would like my website to be available in English and Russian only. I will take care to translate all the labels in these languages. The user experience would be very poor when selecting German as a language.

Originally posted by @barredterra in #12813 (comment)

@ankush ankush removed the add-test-cases Add test case to validate fix or enhancement label Aug 9, 2022
@ankush ankush merged commit e5b8a47 into frappe:version-14-hotfix Aug 9, 2022
mergify bot pushed a commit that referenced this pull request Aug 9, 2022
… languages and language default always will be System default (#17745)

* feat: Select only enabled languages for "language selector", and use System Settings lang as default one

[skip ci]

(cherry picked from commit e5b8a47)
ankush pushed a commit that referenced this pull request Aug 9, 2022
… languages and language default always will be System default (#17745) (#17766)

* feat: Select only enabled languages for "language selector", and use System Settings lang as default one

[skip ci]

(cherry picked from commit e5b8a47)

Co-authored-by: Development for People <47140294+developmentforpeople@users.noreply.github.com>
frappe-pr-bot pushed a commit that referenced this pull request Aug 11, 2022
# [14.1.0](v14.0.2...v14.1.0) (2022-08-11)

### Bug Fixes

* add_user_permission with applicale_for arg set not updating in user permission ([804ce72](804ce72))
* assume parentfield to be set and valid ([e28674b](e28674b))
* check permlevel only if > 0 ([63f2cf5](63f2cf5))
* consistent fieldnames and keep port alongside server field ([c4f1619](c4f1619))
* **db:** Log mogrified queries ([ba1cdf8](ba1cdf8))
* dont init child doc ([94b760c](94b760c))
* dont pass doc to tooltip formatter on reportview ([d049c87](d049c87))
* german translations ([#17663](#17663)) ([#17771](#17771)) ([fd3eaa6](fd3eaa6))
* get correct doc when checking child table permission ([9b89dc6](9b89dc6))
* handle permlevel ([06ebd95](06ebd95))
* ignore built assets in translation ([53357e2](53357e2))
* ignore forms without docs in realtime events ([afc060f](afc060f))
* init only existing single doctypes ([75b6a33](75b6a33))
* limit allowed attributes for lazy images ([#17775](#17775)) ([1311564](1311564))
* **patch:** update multi step webform's Section Break fields to Page Break ([#17797](#17797)) ([#17798](#17798)) ([b3dc4c0](b3dc4c0))
* raise ImplicitCommitError instead of bare exception ([e2c6497](e2c6497))
* reverse logic for failing permission check ([7891674](7891674))
* **sanitize-html:** allow all data-* attrs ([9b94479](9b94479))
* send all messages on boot instead of scanning ([d61b7e8](d61b7e8))
* update append_to misleading message in email account ([#17718](#17718)) ([#17796](#17796)) ([cd86462](cd86462))
* **ux:** email domain doctype ([48c4a8d](48c4a8d))
* Webform Misc Fix (backport [#17642](#17642)) ([#17746](#17746)) ([86f9fbc](86f9fbc))

### Features

* JS extractor and custom JS parser ([fed4ae9](fed4ae9))
* **minor:** add connection link to email accounts in email domain ([821549d](821549d))
* **minor:** fetch attachment_limit from get_max_file_size api ([5190a49](5190a49))
* modified parser for frappe JS translate syntax ([0e87d21](0e87d21))
* Multilanguage sites: language selector only will show "enabled" languages and language default always will be System default ([#17745](#17745)) ([e5b8a47](e5b8a47))
* use AST to extract translation sources ([e02a73f](e02a73f))

### Performance Improvements

* reduce DB calls made in `get_fetch_values` ([#17671](#17671)) ([#17739](#17739)) ([dc19f69](dc19f69))

### Reverts

* Remove emoji from doctype ([c102124](c102124))
@frappe-pr-bot
Copy link
Collaborator

🎉 This PR is included in version 14.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport develop port port to develop branch released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants