Commit Graph

10 Commits

Author SHA1 Message Date
Cody Cutrer 14916ec538 allow tagging custom locales
fixes CNVS-28111

test plan:
 * edit config/locales.yml, and add `custom: true` under one of the
   locales (such as japanese:
ja:
  locales:
    ja: Custom Japanese!
  custom: true
 * load up Canvas (be sure you're using RAILS_LOAD_ALL_LOCALES=1),
   and Japanese should no longer show up in the account or users
   pages to select
 * go to /plugins/i18n, and enable the plugin, and check the custom
   locale (it will be the only one listed), and save
 * the "custom" locale should show up in dropdowns again

Change-Id: Iae6c923b50262b27a25487a0d8458b2627809630
Reviewed-on: https://gerrit.instructure.com/74795
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-04-04 15:04:34 +00:00
Jon Jensen 5a040333cd i18nliner(.rb)
this swaps out (most of) our ruby haax with i18nliner

test plan:
1. verify string extraction:
   1. `rake i18n:generate` before and after this commit
   2. confirm `config/locales/generated/en.yml` is identical
2. verify english defaults:
   1. use canvas in english
   2. confirm everything looks correct
3. verify translation keys/scopes:
   1. run canvas w/ RAILS_LOAD_ALL_LOCALES=true and optimized js
   2. use canvas in spanish
   3. confirm that todo está bien
4. confirm you can now use i18nliner-y features:
   1. call `t` without a key
   2. use the fancy erb block syntax

Change-Id: I979479c0889fe7e31ee0c962a4bd1998ab54d711
Reviewed-on: https://gerrit.instructure.com/42785
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jennifer Stern <jstern@instructure.com>
Product-Review: Jennifer Stern <jstern@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
2014-10-29 21:59:39 +00:00
Cody Cutrer a12d2b69b0 handle locales-gone-missing
refs CNVS-15736

test plan:
 * set the locale for an account, course, and user to something explicit
 * remove that locale (see g/41630)
 * restart your server, and your language for each of the above should
   have reverted back to the default. also, editing the preferred
   locale for any of them should show system default again

Change-Id: Ic25290a4374a596610ffa97ad21aecd3a86f1bed
Reviewed-on: https://gerrit.instructure.com/41775
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-10-09 15:44:43 +00:00
Jeff Belser d7503ce64c locale query params for session_locale
fixes CAT-330

NOTE: *the locale for a page is inferred in a weighted order.
       session_locale is checked just before a provided context's
       account locale preference and just after the user's

Test Plan
  1. Fire up canvas with full i18n support configured
     (i.e. $ RAILS_LOAD_ALL_LOCALES=true rails server)
  2. Navigate to a page that supports localization while logged out
     such as the login screen
  3. Append the following query params to the URL in the browser
     '?session_locale=zh'
  4. Navigate to that URL and ensure the page is localized in the provided
     locale

Change-Id: I9e94d6ecfd41e77683940272aa0988c67064b602
Reviewed-on: https://gerrit.instructure.com/39844
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ethan Gunderson <egunderson@instructure.com>
Reviewed-by: Nick Houle <nhoule@instructure.com>
Product-Review: Adam Phillipps <adam@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2014-09-02 19:53:32 +00:00
Simon Williams 0f25871915 tweak tie-breaking logic for Accept-Language header
previously in the case of ties in the quality value we sorted by length (so en
beats en-US), and then alphabetically (so ar beats en).  this part of the spec
is somewhat ambiguous, but this ordering does not take into account the order
passed into the accept header.  so passing "en,ar" would have chosen 'ar'
because quality and length both tie, and 'ar' is first alphabetically.

to fix this we are incorporating the order of the types passed into the accept
header as one of the tie breaking criteria.

this fixes the bug with CutyCapt snapshots of canvas being rendered in arabic
because CutyCapt passes "en,*" as it's accept header.  up until recently, 'en'
happened to be alphabetically first in our list of supported languages, so
everything worked out.  but when we added support for arabic, a new
alphabetical winner emerged, exposing this bug.

fixes CNVS-3070

test plan:
- in an environment with CutyCapt enabled
- create a web submission assignment that allows url submissions
- submit a canvas url that has this fix applied (note that you can run this
  from anywhere, it's the url you submit that needs the fix)
- it should be in english, not arabic

Change-Id: I7cf6d9db02ec0e79ad425bc0479c4fc43942fa52
Reviewed-on: https://gerrit.instructure.com/24348
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Liz Abinante <labinante@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2013-09-17 21:56:36 +00:00
Jon Jensen 81e50dbc71 switch out i18n backend, closes CNVS-5938
test plan:
1. specs should pass
2. run canvas with RAILS_LOAD_ALL_LOCALES=1
3. you should be able to switch locales and see translations
4. run i18n:generate on the parent commit and on this commit, the
   resulting config/locales/generated/en.yml should be identical

Change-Id: I5164943dc6e682c663145e91d7a9791331e9b4cc
Reviewed-on: https://gerrit.instructure.com/21014
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
2013-06-06 18:11:28 +00:00
James Williams 9c0e883a7f add warning popover for 'crowdsourced' locales
test plan:
* there are no crowdsourced locales currently, so
 before starting the server,
 add one by manually editing config/locales/locales.yml
 and adding "crowdsourced: true" under a language, e.g.:

>en:
>  locales:
>    en: English
>  crowdsourced: true

* for each area where a language is selectable:
 * use the select box to select a crowdsourced language
 * and confirm that an icon appears, and that hovering over it
reveals a popover warning box about selecting a crowdsourced
language

* areas to test:
 * current user's profile settings
  (visit '/profile/settings' -> click "Edit Settings")
 * account settings
 * course settings

closes #CNVS-4967 #CNVS-4278

Change-Id: I2e83df950b815fb01e5f0a2aa324020415198e5a
Reviewed-on: https://gerrit.instructure.com/21019
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2013-05-31 18:44:30 +00:00
Simon Williams 88769625ca infer locale for groups based on group context; fixes #7069
groups cheat and set @context to the group after get_context runs but before
set_locale runs, but we want to infer the locale based on the group context
(the actual context), if it has one.

test-plan:
- in a course with student groups
- set the course language to spanish
- go to the group page, it should also be in spanish

Change-Id: I2fcdd4c4b416eafbe1bddb5c91c77360448f75f2
Reviewed-on: https://gerrit.instructure.com/9845
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-04-09 10:48:19 -06:00
Jon Jensen f3beda6ed6 localize notifications according to user's locale (or browser_locale)
Change-Id: I39d76c156182f448c4c7efa6743c14ac70dd0faf
Reviewed-on: https://gerrit.instructure.com/4906
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2011-08-03 13:13:29 -06:00
Jon Jensen 5e66286c14 locale detection and selection, refs #4994
Change-Id: I0f1e50d912ba7ac81b9ceb3ae95baaba3a12425b
Reviewed-on: https://gerrit.instructure.com/4661
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-07-20 09:24:55 -06:00