1d5283ca62ce1486a56de11095258dcfcab792e4
Integration/Tutorials/Localization.md
| ... | ... | @@ -52,110 +52,16 @@ The language pack consists of a set of \*.resx files inside “Resources” fold |
| 52 | 52 | |
| 53 | 53 |  |
| 54 | 54 | |
| 55 | -###Set up localization in the code |
|
| 56 | - |
|
| 57 | -You can set up the localization language almost anywhere in the code by specifying the AdHocSettings.Language setting. |
|
| 58 | -But normally you would like to set localization in the PostLogin() method of the CustomAdHocConfig class in the Global.asax file because different users might like to use different languages: |
|
| 59 | - |
|
| 60 | -``` c# |
|
| 61 | -public override void PostLogin() |
|
| 62 | -{ |
|
| 63 | - AdHocSettings.Language = AdHocLanguage.French; |
|
| 64 | -} |
|
| 65 | -``` |
|
| 66 | - |
|
| 67 | -Let’s suppose you need Izenda Reports in French. Here is a step-by-step list of actions you need to perform to accomplish this: |
|
| 55 | +Here is a step-by-step list of actions you need to perform to accomplish this: |
|
| 68 | 56 | 1. Locate the “bin” directory inside the folder with your website. It should contain file named “Izenda.AdHoc.dll”. |
| 69 | 57 | 2. Create a “Resources” folder there. So the target folder will be “..\bin\Resources” |
| 70 | 58 | 3. Refer to section [What Languages Are Included?](#IncludedLanguages) and get from localization pack the *.resx with name corresponding to the language you need (in our case this will be “French.resx” file). |
| 71 | 59 | 4. Copy that file from the localization pack into the previously created “..\bin\Resources” folder of your website (in our case the full file path will be “..\bin\Resources\French.resx”). |
| 72 | 60 | 5. Replace your license key with one supporting localization. Please contact support@izenda.com or your account manager for details. |
| 73 | 61 | |
| 74 | -###How To Set The Language I Want To Use? |
|
| 75 | - |
|
| 76 | -You should specify the AdHocSettings.Language setting in the code. This should be done in the [[InitializeReporting() method in the CustomAdHocConfig class in the Global.asax file. You can set this globally for all users or use logic to change the language per user or per tenant as you like. |
|
| 77 | - |
|
| 78 | -####Global |
|
| 79 | - |
|
| 80 | -``` csharp |
|
| 81 | -public static void InitializeReporting() |
|
| 82 | -{ |
|
| 83 | - AdHocSettings.Language = AdHocLanguage.French; |
|
| 84 | -} |
|
| 85 | - |
|
| 86 | -``` |
|
| 87 | - |
|
| 88 | -####Per Country By Tenant(Customer) ID |
|
| 89 | - |
|
| 90 | -```csharp |
|
| 91 | -public static void InitializeReporting() |
|
| 92 | -{ |
|
| 93 | - switch ( GetUserCountry()){ |
|
| 94 | - case "USA": |
|
| 95 | - case "UK": |
|
| 96 | - case "Ireland": |
|
| 97 | - AdHocSettings.Language = AdHocLanguage.English; |
|
| 98 | - break; |
|
| 99 | - case "France": |
|
| 100 | - AdHocSettings.Language = AdHocLanguage.French; |
|
| 101 | - break; |
|
| 102 | - case "Spain": |
|
| 103 | - case "Mexico": |
|
| 104 | - case "Venezuela": |
|
| 105 | - case "Argentina": |
|
| 106 | - case "Brazil": |
|
| 107 | - AdHocSettings.Language = AdHocLanguage.Spanish; |
|
| 108 | - break; |
|
| 109 | - case "Germany": |
|
| 110 | - case "Austria": |
|
| 111 | - case "Poland": |
|
| 112 | - case "Switzerland": |
|
| 113 | - AdHocSettings.Language = AdHocLanguage.German; |
|
| 114 | - break; |
|
| 115 | - case "Russia": |
|
| 116 | - AdHocSettings.Language = AdHocLanguage.Russian; |
|
| 117 | - break; |
|
| 118 | - case "Japan": |
|
| 119 | - AdHocSettings.Language = AdHocLanguage.Japanese; |
|
| 120 | - break; |
|
| 121 | - case "China": |
|
| 122 | - AdHocSettings.Language = AdHocLanguage.ChinesePeoplesRepublicofChina; |
|
| 123 | - break; |
|
| 124 | - case "Taiwan": |
|
| 125 | - AdHocSettings.Language = AdHocLanguage.ChineseTaiwan; |
|
| 126 | - break; |
|
| 127 | - case "Italy": |
|
| 128 | - AdHocSettings.Language = AdHocLanguage.Italian; |
|
| 129 | - break; |
|
| 130 | - case "South Korea": |
|
| 131 | - case "North Korea": |
|
| 132 | - case "Korea": |
|
| 133 | - AdHocSettings.Language = AdHocLanguage.Korean; |
|
| 134 | - break; |
|
| 135 | - case "Belgium": |
|
| 136 | - AdHocSettings.Language = AdHocLanguage.Dutch; |
|
| 137 | - break; |
|
| 138 | - default: |
|
| 139 | - AdHocSettings.Language = AdHocLanguage.English; |
|
| 140 | - break; |
|
| 141 | - } |
|
| 142 | -} |
|
| 143 | - |
|
| 144 | -public static string GetUserCountry() { |
|
| 145 | - String sql = string.Format(@"SELECT [dbo].[Customers].[Country] FROM [dbo].[Customers] WHERE [dbo].[Customers].[CustomerID] = '{0}'", AdHocSettings.CurrentUserTenantId); |
|
| 146 | - SqlCommand cmd = new SqlCommand(sql); |
|
| 147 | - DataSet ds = new DataSet(); |
|
| 148 | - using (SqlConnection connection = new SqlConnection(AdHocSettings.SqlServerConnectionString)) { |
|
| 149 | - connection.Open(); |
|
| 150 | - cmd.Connection = connection; |
|
| 151 | - IDbDataAdapter dataAdapter = new SqlDataAdapter(cmd); |
|
| 152 | - dataAdapter.Fill(ds); |
|
| 153 | - } |
|
| 154 | - return ds.Tables[0].Rows.Count == 0 ? string.Empty : ds.Tables[0].Rows[0][0].ToString(); |
|
| 155 | -} |
|
| 156 | -``` |
|
| 62 | +###How To Set The Language I Want To Use In Code? |
|
| 157 | 63 | |
| 158 | -In the above example, CurrentUserTenantID will be set to a company ID (such as ALFKI) and the country will be obtained and the language set. |
|
| 64 | +You should specify the [[AdHocSettings.Language|/API/CodeSamples/Language]]. This should be done in the [[InitializeReporting() method in the CustomAdHocConfig class in the Global.asax file. You can set this globally for all users or use logic to change the language per user or per tenant as you like. |
|
| 159 | 65 | |
| 160 | 66 | ###Can I Change Some Or All Of The Resources? |
| 161 | 67 |