<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Hmukhta</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Hmukhta"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Hmukhta"/>
	<updated>2026-08-13T15:23:45Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121508</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121508"/>
		<updated>2018-12-11T20:45:03Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Adding Multi-Language Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
*** _publishing_rights.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many students are from other countries. So, we aimed to allow them to view their pages in another language. This is done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown. We focused on adding the Hindi language as a lot of students are Indian.&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;student_task&amp;lt;/code&amp;gt; is the folder under views: &amp;lt;code&amp;gt;views/student_task&amp;lt;/code&amp;gt;&lt;br /&gt;
* list is the name of the html page: &amp;lt;code&amp;gt;view/student_task/list.html.erb&amp;lt;/code&amp;gt;&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** Other Info&lt;br /&gt;
*** Because the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; know what view folders to look in when choosing the keys, when you type . for the key_namefor the translation code (shown above), it will show the list of keys available for the html page you are in, at least in RubyMine. &lt;br /&gt;
*** Reference keys in other html files (Look at below code for example)&lt;br /&gt;
**** You can reference keys under from another html file within the same sub view folder.&lt;br /&gt;
***** For example, you can reference the key &amp;lt;code&amp;gt;select_assignment&amp;lt;/code&amp;gt; from the &amp;lt;code&amp;gt;view/student_task/view.html.erb&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;view/student_task/list.html.erb&amp;lt;/code&amp;gt; by doing &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.view.select_assignment&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt; for a static string in &amp;lt;code&amp;gt;view/student_task/list.html.erb&amp;lt;/code&amp;gt;&lt;br /&gt;
**** You can reference keys from another html file in a different sub view folder&lt;br /&gt;
***** For example, you can reference the key &amp;lt;code&amp;gt;sign_up&amp;lt;/code&amp;gt; from &amp;lt;code&amp;gt;view/publishing/view.html.erb&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;view/student_task/list.html.erb&amp;lt;/code&amp;gt; from by doing &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.publishing.view.sign_up&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt; for a static string in &amp;lt;code&amp;gt;view/student_task/list.html.erb&amp;lt;/code&amp;gt;&lt;br /&gt;
**** By referencing keys not in the html file you are working on, you can reduce duplicate key names.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task&lt;br /&gt;
      list:&lt;br /&gt;
        assignment: &amp;quot;Assignment&amp;quot;&lt;br /&gt;
      view:&lt;br /&gt;
        select_assignment: &amp;quot;Select Assignment&amp;quot;&lt;br /&gt;
    publishing&lt;br /&gt;
      view:&lt;br /&gt;
        sign_up: &amp;quot;Sign Up&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Internationalization ssignment main page.JPG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Internationalization assignment main translated page.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages, not on the browser&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below, not the link in the navigation bar.&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, by clicking the link in the navigation bar, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, it will go back to the default locale language. See the URL below:&lt;br /&gt;
*** [[File:Internationalization assignment link langauge error.JPG]]&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** [[File:Internationalization langauge dropdown error.JPG]]&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
** We also have translated keys for many course pages, but did not implement the actual translation code in the view files for them. You should be able to look at the keys to find out which view files they are.&lt;br /&gt;
** Adding translation for Chinese.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video: https://youtu.be/TA9PkcK61QM&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121506</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121506"/>
		<updated>2018-12-11T20:34:00Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Adding Multi-Language Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
*** _publishing_rights.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many students are from other countries. So, we aimed to allow them to view their pages in another language. This is done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown. We focused on adding the Hindi language as a lot of students are Indian.&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;student_task&amp;lt;/code&amp;gt; is the folder under views: &amp;lt;code&amp;gt;views/student_task&amp;lt;/code&amp;gt;&lt;br /&gt;
* list is the name of the html page: &amp;lt;code&amp;gt;view/student_task/list.html.erb&amp;lt;/code&amp;gt;&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** Other Info&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task&lt;br /&gt;
      list:&lt;br /&gt;
        assignment: &amp;quot;Assignment&amp;quot;&lt;br /&gt;
      view:&lt;br /&gt;
        select_assignment: &amp;quot;Select Assignment&amp;quot;&lt;br /&gt;
    publishing&lt;br /&gt;
      view:&lt;br /&gt;
        sign_up: &amp;quot;Sign Up&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
** Reference keys in other html files&lt;br /&gt;
*** You can also reference keys under from another html files within the same sub view folder.&lt;br /&gt;
**** For example, in student_task folder, you can reference the key select_assignment from the view.html.erb in list.html.erb by doing &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.view.select_assignment&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt; for a static string in list.html.erb&lt;br /&gt;
*** You can reference keys from another html files in another sub view folder&lt;br /&gt;
**** For example, you can reference the key sign_up from the view.html.erb in view/publishing in list.html.erb from view/student_task by doing &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.publishing.view.sign_up&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt; for a static string in list.html.erb&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Internationalization ssignment main page.JPG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Internationalization assignment main translated page.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages, not on the browser&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below, not the link in the navigation bar.&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, by clicking the link in the navigation bar, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, it will go back to the default locale language. See the URL below:&lt;br /&gt;
*** [[File:Internationalization assignment link langauge error.JPG]]&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** [[File:Internationalization langauge dropdown error.JPG]]&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
** We also have translated keys for many course pages, but did not implement the actual translation code in the view files for them. You should be able to look at the keys to find out which view files they are.&lt;br /&gt;
** Adding translation for Chinese.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video: https://youtu.be/TA9PkcK61QM&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121078</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121078"/>
		<updated>2018-12-06T20:25:00Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
*** _publishing_rights.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many students are from other countries. So, we aimed to allow them to view their pages in another language. This is done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown. We focused on adding the Hindi language as a lot of students are Indian.&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Internationalization ssignment main page.JPG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Internationalization assignment main translated page.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages, not on the browser&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below, not the link in the navigation bar.&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, by clicking the link in the navigation bar, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, it will go back to the default locale language. See the URL below:&lt;br /&gt;
*** [[File:Internationalization assignment link langauge error.JPG]]&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** [[File:Internationalization langauge dropdown error.JPG]]&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
** We also have translated keys for many course pages, but did not implement the actual translation code in the view files for them. You should be able to look at the keys to find out which view files they are.&lt;br /&gt;
** Adding translation for Chinese.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121077</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121077"/>
		<updated>2018-12-06T20:18:13Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
*** _publishing_rights.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many students are from other countries. So, we aimed to allow them to view their pages in another language. This is done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown. We focused on adding the Hindi language as a lot of students are Indian.&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Internationalization ssignment main page.JPG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Internationalization assignment main translated page.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages, not on the browser&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below, not the link in the navigation bar.&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** [[File:Internationalization assignment link langauge error.JPG]]&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** [[File:Internationalization langauge dropdown error.JPG]]&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
** We also have translated keys for many course pages, but did not implement the actual translation code in the view files for them. You should be able to look at the keys to find out which view files they are.&lt;br /&gt;
** Adding translation for Chinese.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121076</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121076"/>
		<updated>2018-12-06T20:16:41Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
*** _publishing_rights.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. So, we aimed to allow students to view their pages in another language. This is done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Internationalization ssignment main page.JPG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Internationalization assignment main translated page.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages, not on the browser&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below, not the link in the navigation bar.&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** [[File:Internationalization assignment link langauge error.JPG]]&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** [[File:Internationalization langauge dropdown error.JPG]]&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
** We also have translated keys for many course pages, but did not implement the actual translation code in the view files for them. You should be able to look at the keys to find out which view files they are.&lt;br /&gt;
** Adding translation for Chinese.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121075</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121075"/>
		<updated>2018-12-06T20:15:27Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
*** _publishing_rights.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. So, we aimed to allow students to view their pages in another language. This is done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Internationalization ssignment main page.JPG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Internationalization assignment main translated page.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages, not on the browser&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below, not the link in the navigation bar.&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** [[File:Internationalization assignment link langauge error.JPG]]&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** [[File:Internationalization langauge dropdown error.JPG]]&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
** We also have translated keys for many course pages, but did not implement the actual translation code in the view files for them. You should be able to look at the keys to find out which view files they are.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121071</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121071"/>
		<updated>2018-12-06T19:36:14Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Before Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
*** _publishing_rights.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Internationalization ssignment main page.JPG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Internationalization assignment main translated page.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages, not on the browser&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below, not the link in the navigation bar.&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** [[File:Internationalization assignment link langauge error.JPG]]&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** [[File:Internationalization langauge dropdown error.JPG]]&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
** We also have translated keys for many course pages, but did not implement the actual translation code in the view files for them. You should be able to look at the keys to find out which view files they are.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121068</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121068"/>
		<updated>2018-12-06T19:17:20Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Relevant Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
*** _publishing_rights.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Internationalization ssignment main page.JPG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Internationalization assignment main translated page.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** [[File:Internationalization assignment link langauge error.JPG]]&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** [[File:Internationalization langauge dropdown error.JPG]]&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
** We also have translated keys for many course pages, but did not implement the actual translation code in the view files for them. You should be able to look at the keys to find out which view files they are.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121067</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121067"/>
		<updated>2018-12-06T19:16:32Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Internationalization ssignment main page.JPG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Internationalization assignment main translated page.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** [[File:Internationalization assignment link langauge error.JPG]]&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** [[File:Internationalization langauge dropdown error.JPG]]&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
** We also have translated keys for many course pages, but did not implement the actual translation code in the view files for them. You should be able to look at the keys to find out which view files they are.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121066</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121066"/>
		<updated>2018-12-06T19:14:45Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Internationalization ssignment main page.JPG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Internationalization assignment main translated page.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** [[File:Internationalization assignment link langauge error.JPG]]&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** [[File:Internationalization langauge dropdown error.JPG]]&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121065</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121065"/>
		<updated>2018-12-06T19:13:46Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Internationalization ssignment main page.JPG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Internationalization assignment main translated page.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** [[File:Internationalization langauge dropdown error.JPG]]&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** [[File:Internationalization assignment link langauge error.JPG]]&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Internationalization_assignment_link_langauge_error.JPG&amp;diff=121064</id>
		<title>File:Internationalization assignment link langauge error.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Internationalization_assignment_link_langauge_error.JPG&amp;diff=121064"/>
		<updated>2018-12-06T19:13:29Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: language goes away in URL when you click the assignment link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;language goes away in URL when you click the assignment link&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121063</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121063"/>
		<updated>2018-12-06T19:12:06Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Internationalization ssignment main page.JPG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Internationalization assignment main translated page.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** [[File:Internationalization langauge dropdown error.JPG]]&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** image here&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Internationalization_langauge_dropdown_error.JPG&amp;diff=121062</id>
		<title>File:Internationalization langauge dropdown error.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Internationalization_langauge_dropdown_error.JPG&amp;diff=121062"/>
		<updated>2018-12-06T19:11:43Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: Error for when you change a language with a dropdown in page other than the main assignment page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Error for when you change a language with a dropdown in page other than the main assignment page&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121061</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121061"/>
		<updated>2018-12-06T19:09:23Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Original Page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Internationalization ssignment main page.JPG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Internationalization assignment main translated page.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** image here&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** image here&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121060</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121060"/>
		<updated>2018-12-06T19:08:21Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Translated Page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Internationalization assignment main page.JPG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Internationalization assignment main translated page.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** image here&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** image here&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121059</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121059"/>
		<updated>2018-12-06T19:08:08Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Original Page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Internationalization assignment main page.JPG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** image here&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** image here&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Internationalization_assignment_main_translated_page.JPG&amp;diff=121058</id>
		<title>File:Internationalization assignment main translated page.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Internationalization_assignment_main_translated_page.JPG&amp;diff=121058"/>
		<updated>2018-12-06T19:07:41Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: main assignment page translated to Hindi&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; main assignment page translated to Hindi&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Internationalization_ssignment_main_page.JPG&amp;diff=121057</id>
		<title>File:Internationalization ssignment main page.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Internationalization_ssignment_main_page.JPG&amp;diff=121057"/>
		<updated>2018-12-06T19:07:09Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: The main assigment page in english&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main assigment page in english&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121055</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121055"/>
		<updated>2018-12-06T18:50:54Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Example Output */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** image here&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** image here&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121054</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121054"/>
		<updated>2018-12-06T18:49:30Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Adding Multi-Language Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. &lt;br /&gt;
*** Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would now look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** image here&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** image here&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121053</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121053"/>
		<updated>2018-12-06T18:47:19Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Adding Multi-Language Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Regular Static Strings&lt;br /&gt;
*** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace &amp;quot;Assignment&amp;quot;, with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
*** This is how you would change the strings for an html page.&lt;br /&gt;
** Static strings for buttons, dropdowns, etc.&lt;br /&gt;
*** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;code&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;. &lt;br /&gt;
*** It would look like this &amp;lt;code&amp;gt; &amp;lt;%= submit_tag t('.key_name') %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** image here&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** image here&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121052</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121052"/>
		<updated>2018-12-06T18:38:33Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Adding Multi-Language Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
** You can also translate static string field values that you would find in buttons, dropdowns, etc. When you change these types of strings, you need slightly different code to translate it. Example: &amp;lt;code&amp;gt;&amp;lt;%= submit_tag 'Save' %&amp;gt; &amp;lt;/code&amp;gt;. You would replace 'Save' with &amp;lt;cod&amp;gt;t('.key_name')&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** image here&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** image here&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121050</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121050"/>
		<updated>2018-12-06T18:30:56Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Allowing Student to change language for Assignment Pages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* [[File: Internationalization Navigation dropdown 2.JPG]]&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** image here&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** image here&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Internationalization_Navigation_dropdown_2.JPG&amp;diff=121046</id>
		<title>File:Internationalization Navigation dropdown 2.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Internationalization_Navigation_dropdown_2.JPG&amp;diff=121046"/>
		<updated>2018-12-06T18:27:10Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: Placement of the dropdown in the navigation bar&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Placement of the dropdown in the navigation bar&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121040</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121040"/>
		<updated>2018-12-06T18:17:49Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Adding Multi-Language Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** [[File:Internationalization Route rb 2.JPG]]&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** image here&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** image here&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Internationalization_Route_rb_2.JPG&amp;diff=121038</id>
		<title>File:Internationalization Route rb 2.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Internationalization_Route_rb_2.JPG&amp;diff=121038"/>
		<updated>2018-12-06T18:13:31Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: Routes.rb file with internationalization&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Routes.rb file with internationalization&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121001</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121001"/>
		<updated>2018-12-05T23:41:23Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, views/student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** image here&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main Assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** image here&lt;br /&gt;
** But if you manually change the language in the URL, it works fine and persists as you navigate through the pages. &lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121000</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=121000"/>
		<updated>2018-12-05T23:38:40Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** image here&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** image here&lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120999</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120999"/>
		<updated>2018-12-05T23:38:27Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
* Due to time, there were some things we weren't able to fix or work on.&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** image here&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** image here&lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not in the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120998</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120998"/>
		<updated>2018-12-05T23:37:34Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
* Due to time, there were some problems that we weren't able to fix or work on&lt;br /&gt;
* Problems:&lt;br /&gt;
** When a student goes back to the main Assignment page, student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language from the dropdown or manually, clicking the Assignment link in the navigation bar will go back to the default locale language. &lt;br /&gt;
*** image here&lt;br /&gt;
** If you try to use the language dropdown in a page other than the main assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** image here&lt;br /&gt;
* Feature:&lt;br /&gt;
** Having a translation only show up for the user who changes it and not affect the entire system.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120996</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120996"/>
		<updated>2018-12-05T23:34:13Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
* Due to time, there were some problems that we weren't able to fix&lt;br /&gt;
* They are:&lt;br /&gt;
** When a student goes back to the main Assignment page, student_task/list, the language locale doesn't appear in the URL. This means that if you did change the language and click the Assignment link in the navigation bar, it will go back to the default locale language. &lt;br /&gt;
** If you try to use the language dropdown in a page other than the main assignment page, it will give an error like the one shown below:&lt;br /&gt;
*** image here&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120995</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120995"/>
		<updated>2018-12-05T23:29:10Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Links/References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120994</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120994"/>
		<updated>2018-12-05T23:24:22Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Navigation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Before Testing====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120993</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120993"/>
		<updated>2018-12-05T23:23:56Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Navigation====&lt;br /&gt;
&lt;br /&gt;
* When going between pages, use the Back button link located on the bottom of pages&lt;br /&gt;
* When going to the main Assignment page, use the Back button link to get there to test out the scenarios below&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120992</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120992"/>
		<updated>2018-12-05T23:17:13Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
3. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
4. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
5. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
6. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
7. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
8. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. &lt;br /&gt;
&lt;br /&gt;
2. Go to URL and change the language from en to hi_IN. &lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Now change the language back from hi_IN to en in the URL. &lt;br /&gt;
&lt;br /&gt;
6. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120991</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120991"/>
		<updated>2018-12-05T23:14:47Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
2. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to language dropdown in the navigation bar and choose Hindi. &lt;br /&gt;
&lt;br /&gt;
2. Check if language is changed in the URL from en to hi_IN&lt;br /&gt;
&lt;br /&gt;
3. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
4. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
5. Go back to the main Assignment page and choose English from the dropdown. &lt;br /&gt;
&lt;br /&gt;
6. See if the language was changed in the URL to en. &lt;br /&gt;
&lt;br /&gt;
7. See if the strings are translated back to English for all Assignment related pages. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to URL and change the language from en to hi_IN. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to URL and change the language from en to hi_IN. Check to see if the English strings on the page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
3. Now change the language back from hi_IN to en in the URL. See if the Hindi strings are translated back to English for all Assignment related pages.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120990</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120990"/>
		<updated>2018-12-05T23:09:32Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Scenario 1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on the page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
3. Go back to the main Assignment page and choose English from the dropdown. See if the strings are translated back to English.&lt;br /&gt;
&lt;br /&gt;
4. Check the other pages to see if the translations worked. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to URL and change the language from en to hi_IN. Check to see if the English strings on that page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to URL and change the language from en to hi_IN. Check to see if the English strings on that page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
3. Now change the language back from hi_IN to en in the URL. See if the Hindi strings are translated back to English.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120989</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120989"/>
		<updated>2018-12-05T23:08:58Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Student Credentials */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016 or student[4000-8000]&lt;br /&gt;
&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
3. Go back to the main Assignment page and choose English from the dropdown. See if the strings are translated back to English.&lt;br /&gt;
&lt;br /&gt;
4. Check the other pages to see if the translations worked. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to URL and change the language from en to hi_IN. Check to see if the English strings on that page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to URL and change the language from en to hi_IN. Check to see if the English strings on that page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
3. Now change the language back from hi_IN to en in the URL. See if the Hindi strings are translated back to English.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120988</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120988"/>
		<updated>2018-12-05T23:08:09Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Student Credentials====&lt;br /&gt;
username: student1016&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
username: student[4000-8000]&lt;br /&gt;
password: password&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
3. Go back to the main Assignment page and choose English from the dropdown. See if the strings are translated back to English.&lt;br /&gt;
&lt;br /&gt;
4. Check the other pages to see if the translations worked. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to URL and change the language from en to hi_IN. Check to see if the English strings on that page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to URL and change the language from en to hi_IN. Check to see if the English strings on that page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
3. Now change the language back from hi_IN to en in the URL. See if the Hindi strings are translated back to English.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120987</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120987"/>
		<updated>2018-12-05T23:05:10Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Allowing Student to change language for Assignment Pages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also manually change the language in the URL themselves by. The language is put before the page name. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
3. Go back to the main Assignment page and choose English from the dropdown. See if the strings are translated back to English.&lt;br /&gt;
&lt;br /&gt;
4. Check the other pages to see if the translations worked. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to URL and change the language from en to hi_IN. Check to see if the English strings on that page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to URL and change the language from en to hi_IN. Check to see if the English strings on that page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
3. Now change the language back from hi_IN to en in the URL. See if the Hindi strings are translated back to English.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120986</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120986"/>
		<updated>2018-12-05T23:01:14Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Scenarios */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also language in the url themselves to switch the langauge. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Scenario 1====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 2====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
3. Go back to the main Assignment page and choose English from the dropdown. See if the strings are translated back to English.&lt;br /&gt;
&lt;br /&gt;
4. Check the other pages to see if the translations worked. &lt;br /&gt;
&lt;br /&gt;
====Scenario 3====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to URL and change the language from en to hi_IN. Check to see if the English strings on that page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
====Scenario 4====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to URL and change the language from en to hi_IN. Check to see if the English strings on that page are translated to Hindi.&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
3. Now change the language back from hi_IN to en in the URL. See if the Hindi strings are translated back to English.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120985</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120985"/>
		<updated>2018-12-05T21:56:17Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Adding Multi-Language Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also language in the url themselves to switch the langauge. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.key_name&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; key_name &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
** This is how you would change the strings for an html page.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Scenarios====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120984</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120984"/>
		<updated>2018-12-05T21:55:17Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Adding Multi-Language Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also language in the url themselves to switch the langauge. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  locale_name:&lt;br /&gt;
    folder_name:&lt;br /&gt;
      html_page_name:&lt;br /&gt;
        key_name_for_string:&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Below is a sample for how we formatted our two locale files&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* student_task is the folder under views: views/student_task&lt;br /&gt;
* list is the name of the html page: view/student_task/list.html.erb&lt;br /&gt;
* assignments is the key that replaces the word &amp;quot;Assignments&amp;quot; in the code (see next section). &lt;br /&gt;
* If more keys are added, they would need to be added in this format&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; keyName &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Scenarios====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120983</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120983"/>
		<updated>2018-12-05T21:45:19Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Adding Multi-Language Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also language in the url themselves to switch the langauge. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* .yml Files&lt;br /&gt;
** &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files know to look at the &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt; folder when looking for keys to show&lt;br /&gt;
** Because of that, &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files are structured in a hierarchy as shown below:&lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  en:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;Assignments&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  hi_IN:&lt;br /&gt;
    student_task:&lt;br /&gt;
      list:&lt;br /&gt;
        assignments: &amp;quot;असाइनमेंट&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated as shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; keyName &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Scenarios====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120982</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120982"/>
		<updated>2018-12-05T21:34:28Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Adding Multi-Language Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also language in the url themselves to switch the langauge. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
----------------------------&lt;br /&gt;
* Student Views were translated shown below:&lt;br /&gt;
** Take any static, hard coded strings, like this one: &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Assignments &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;, and replace the text with &amp;lt;code&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** The new code would look like this &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;%=t &amp;quot;.keyName&amp;quot; %&amp;gt;&amp;lt;/h1&amp;gt; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; keyName &amp;lt;/code&amp;gt; comes from the key in the &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files. The locale variable (en or hi_IN) would determine which one it pulls from.&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Scenarios====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120981</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120981"/>
		<updated>2018-12-05T21:20:34Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Allowing Student to change language for Assignment Pages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also language in the url themselves to switch the langauge. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
* Dropdown image goes here&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Scenarios====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120980</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120980"/>
		<updated>2018-12-05T21:19:34Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Allowing Student to change language for Assignment Pages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
* Students could also language in the url themselves to switch the langauge. Example: www.example.com/en/book -&amp;gt; www.example.com/hi_IN/book&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Scenarios====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120979</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120979"/>
		<updated>2018-12-05T21:17:42Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Adding Multi-Language Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
------------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
-----------------------------&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Scenarios====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120978</id>
		<title>CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization&amp;diff=120978"/>
		<updated>2018-12-05T20:46:35Z</updated>

		<summary type="html">&lt;p&gt;Hmukhta: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
&lt;br /&gt;
Jonathan Gill (jtgill@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasham Mukhtar (hmukhta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Abhilasha Saini (asaini4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Reddy Aravind Karnam Ganesh (rkarnam@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
Zhewei Hu (zhu6@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Relevant Files===&lt;br /&gt;
&lt;br /&gt;
config/locales/&lt;br /&gt;
&lt;br /&gt;
* en.yml&lt;br /&gt;
&lt;br /&gt;
* hi_IN.yml&lt;br /&gt;
&lt;br /&gt;
config/&lt;br /&gt;
&lt;br /&gt;
* routes.rb&lt;br /&gt;
* application.rb&lt;br /&gt;
&lt;br /&gt;
app/controllers/&lt;br /&gt;
* applcation_controller.rb&lt;br /&gt;
&lt;br /&gt;
Student View Files:&lt;br /&gt;
&lt;br /&gt;
* app/views/&lt;br /&gt;
** shared/&lt;br /&gt;
*** _navigation.html.erb&lt;br /&gt;
** sign_up_sheet/&lt;br /&gt;
*** _suggested_topic.html.erb&lt;br /&gt;
*** _table_header.html.erb&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
** student_task/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** student_teams/&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
*** view.html.erb&lt;br /&gt;
** submitted_content/&lt;br /&gt;
*** _hyperlink.html.erb&lt;br /&gt;
*** _main.html.erb&lt;br /&gt;
*** _self_review.html.erb&lt;br /&gt;
*** _submitted_files.html.erb&lt;br /&gt;
*** _title.html.erb&lt;br /&gt;
*** edit.html.erb&lt;br /&gt;
** grades/&lt;br /&gt;
*** view_my_scores.html.erb&lt;br /&gt;
*** view_team.html.erb&lt;br /&gt;
** student_review/&lt;br /&gt;
*** list.html.erb&lt;br /&gt;
*** _responses.html.erb&lt;br /&gt;
*** _set_dynamic_review.html.erb&lt;br /&gt;
** participants/&lt;br /&gt;
*** change_handle.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Currently Expertiza only supports the English language. Many Expertiza users are from other countries. We aimed to allow students to view their pages in another language. This ase done by internationalizing static strings in Expertiza for Student Assignment related pages to another language (ex: Hindi or Chinese). Students had the ability to change the language through a dropdown located in navigation bar at the top of the page. We did not affect any strings that are dynamically shown..&lt;br /&gt;
&lt;br /&gt;
== Project Design ==&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Allowing Student to change language for Assignment Pages====&lt;br /&gt;
&lt;br /&gt;
* We added a dropdown in the navigation bar for a student to use&lt;br /&gt;
* They are able to choose from English or Hindi&lt;br /&gt;
* When the language is clicked on it changed all the static strings in the Student Views related to Assignments to the newly selected language.&lt;br /&gt;
&lt;br /&gt;
====Adding Multi-Language Support====&lt;br /&gt;
&lt;br /&gt;
* For this project, we added support for one language, Hindi. &lt;br /&gt;
* We used Google Translate to convert the strings to Hindi.&lt;br /&gt;
* We used the [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works Rails Internationalization (I18n) API] to help us add multi language support.&lt;br /&gt;
* There are two &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files in the &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt; directory representing the different languages that can be used in Expertiza.&lt;br /&gt;
** One for English, which will be the default language used, and another for Hindi. &lt;br /&gt;
*** &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
** These &amp;lt;code&amp;gt;yaml&amp;lt;/code&amp;gt; files contained the translated strings for their respective language.&lt;br /&gt;
* We editied the &amp;lt;code&amp;gt;routes.rb, application.rb, application_controller.rb&amp;lt;/code&amp;gt; files and all the view files related to Student Assignments (which you can see at the top of the wiki) so that it can read from the &amp;lt;code&amp;gt;yml&amp;lt;/code&amp;gt; files to show other languages.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We've added the following two lines in the Recaptcha module of this file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.available_locales = [:en,:hi_IN]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This tells the application all the available locale &amp;lt;code&amp;gt;.yml&amp;lt;/code&amp;gt; files that are supported. If you wanted to add more language support, you can just add it to the list shown here.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    config.i18n.default_locale = :en&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* The sets the default language for the application. Which in this case is English.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;application_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
** We added the following to this file to get translations to work:&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  before_action :set_locale &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This will call the set_locale method&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def set_locale&lt;br /&gt;
    I18n.locale = params[:locale] || I18n.default_locale&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This sets the locale (language to use) for the application. The locale is taken from the URL query params list. If none is given, then it defaults to our default locale file (which is English). The application will always default to English and it won't pull from params until another language is chosen from the dropdown and sets :locale to something else. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def default_url_options(options={})&lt;br /&gt;
    {locale: I18n.locale}.merge options&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* This makes the URL always have a locale, which is set in the set_locale method, in it. This way the user doesn't have to manually enter a locale in the URL to translate the page. However, it adds the locale to the end of the URL like this: www.example.com/book/?locale=en. This is not something we want as it doesn't look good. This is fixed with routes.rb&lt;br /&gt;
* &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
** We wrapped the file in &amp;lt;code&amp;gt; routes.rb &amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;scope:&amp;lt;/code&amp;gt; so that the locale can be added before the page name in the URL. Something like this: www.example.com/en/book&lt;br /&gt;
** images here&lt;br /&gt;
*** the code at the top prevents a Routing Error when you go to a page and don't specify the locale (www.example.com/book) and it allows the default locale to be used. It knows the available locales from line &amp;lt;code&amp;gt;/#{I18n.available_locales.join(&amp;quot;|&amp;quot;)} &amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; available_locales &amp;lt;/code&amp;gt; was set in the &amp;lt;code&amp;gt;application.rb&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
===Example Output===&lt;br /&gt;
&lt;br /&gt;
====Original Page====&lt;br /&gt;
[[File:Edit Course default.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Language Dropdown====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock en.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Translated Page====&lt;br /&gt;
&lt;br /&gt;
[[File:Edit Course mock hi IN.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Scenarios====&lt;br /&gt;
&lt;br /&gt;
1. Log in to Expertiza as a student. Go to the Assignment section of Expertiza. Go to language dropdown in the navigation bar and choose Hindi. Check to see if the English strings on that page are translated to Hindi&lt;br /&gt;
&lt;br /&gt;
2. While still logged in as a Student, check if the other Assignment related pages are also translated.&lt;br /&gt;
&lt;br /&gt;
== Links/References ==&lt;br /&gt;
&lt;br /&gt;
===Project Links===&lt;br /&gt;
&lt;br /&gt;
* Pull Request: https://github.com/expertiza/expertiza/pull/1286&lt;br /&gt;
* Github: https://github.com/mukhtar23/expertiza&lt;br /&gt;
* Video:&lt;br /&gt;
&lt;br /&gt;
===Support Material===&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works https://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params https://guides.rubyonrails.org/i18n.html#setting-the-locale-from-url-params]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#abstracting-localized-code https://guides.rubyonrails.org/i18n.html#abstracting-localized-code]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings https://guides.rubyonrails.org/i18n.html#providing-translations-for-internationalized-strings]&lt;br /&gt;
* [https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations]&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=HLb0hEgrXTc https://www.youtube.com/watch?v=HLb0hEgrXTc]&lt;br /&gt;
* [https://phraseapp.com/blog/posts/rails-i18n-guide/ https://phraseapp.com/blog/posts/rails-i18n-guide/]&lt;/div&gt;</summary>
		<author><name>Hmukhta</name></author>
	</entry>
</feed>