Version 1.2

-Ahora ya no se usa una API , si no que se usan llamadas HTTPClient
-Minor bug fix
parent bc0956ae
......@@ -60,11 +60,19 @@
<SignManifests>true</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="DarrenLee.Translator">
<HintPath>bin\DarrenLee.Translator.dll</HintPath>
<Reference Include="Microsoft.Extensions.Configuration, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.2.0.2\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.4.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
......@@ -86,6 +94,7 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Traductor.cs" />
<Compile Include="Utils.cs" />
<EmbeddedResource Include="MainMenu.resx">
<DependentUpon>MainMenu.cs</DependentUpon>
......@@ -99,6 +108,8 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Literals_TemporaryKey.pfx" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
......
This diff is collapsed.
This diff is collapsed.
......@@ -123,7 +123,10 @@
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolTipInfo.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>156, 16</value>
</metadata>
</root>
\ No newline at end of file
......@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Literals")]
[assembly: AssemblyCopyright("Fran Copyright © 2018")]
[assembly: AssemblyCopyright("Fran © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Puede especificar todos los valores o utilizar los números de compilación y de revisión predeterminados
// mediante el carácter '*', como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
using System;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Script.Serialization;
namespace Literals
{
public static class Traductor
{
public static string TranslateText(string input, string languagePair)
{
string url = String.Format("http://www.google.com/translate_t?hl=en&ie=UTF8&text={0}&langpair={1}", input, languagePair);
HttpClient httpClient = new HttpClient();
string result = httpClient.GetStringAsync(url).Result;
result = result.Substring(result.IndexOf("<span title=\"") + "<span title=\"".Length);
result = result.Substring(result.IndexOf(">") + 1);
result = result.Substring(0, result.IndexOf("</span>"));
string decodedString = System.Net.WebUtility.HtmlDecode(result);
string translatedText = decodedString.Trim();
return translatedText;
}
}
}
......@@ -2,9 +2,15 @@
namespace Literals
{
/// <summary>
/// Clase de utiles
/// </summary>
public static class Utils
{
/// <summary>
/// Gets the default loyalty demo configuration.
/// </summary>
/// <returns></returns>
public static List<Idiomas> getDefaultLoyaltyDemoConfig()
{
List<Idiomas> listaIdiomas = new List<Idiomas>();
......@@ -18,13 +24,128 @@ namespace Literals
listaIdiomas.Add(Idiomas.Colombiano);
return listaIdiomas;
}
public static List<Idiomas> getDefaultPeruConfig()
/// <summary>
/// Gets the codigo idioma.
/// </summary>
/// <param name="i">The i.</param>
/// <returns></returns>
public static string getCodigoIdioma(Idiomas i)
{
List<Idiomas> listaIdiomas = new List<Idiomas>();
listaIdiomas.Add(Idiomas.Español);
listaIdiomas.Add(Idiomas.Ingles);
listaIdiomas.Add(Idiomas.Peruano);
return listaIdiomas;
if (i == Idiomas.Colombiano)
{
return "00025";
}
else if (i == Idiomas.Español)
{
return "00001";
}
else if (i == Idiomas.Mexicano)
{
return "00004";
}
else if (i == Idiomas.Peruano)
{
return "00026";
}
else if (i == Idiomas.Ingles)
{
return "00003";
}
else if (i == Idiomas.Americano)
{
return "00057";
}
else if (i == Idiomas.Catalan)
{
return "00006";
}
else if (i == Idiomas.Italiano)
{
return "00012";
}
else if (i == Idiomas.Frances)
{
return "00005";
}
else if (i == Idiomas.Portugues)
{
return "00002";
}
else if (i == Idiomas.Chileno)
{
return "00009";
}
else
{
return "00001";
}
}
/// <summary>
/// Devuelve true si el idioma es castellano
/// </summary>
/// <returns></returns>
public static bool EsCastellano(Idiomas idioma)
{
if( idioma == Idiomas.Colombiano ||
idioma == Idiomas.Español ||
idioma == Idiomas.Mexicano ||
idioma == Idiomas.Chileno ||
idioma == Idiomas.Peruano)
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// Codigoes the idioma.
/// </summary>
/// <param name="i">The i.</param>
/// <returns></returns>
public static string CodigoIdioma(Idiomas i)
{
string code = null;
if (i == Idiomas.Colombiano ||
i == Idiomas.Español ||
i == Idiomas.Mexicano ||
i == Idiomas.Peruano ||
i == Idiomas.Chileno)
{
return "es";
}
else if (i == Idiomas.Ingles ||
i == Idiomas.Americano)
{
return "en";
}
else if (i == Idiomas.Catalan)
{
return "ca";
}
else if (i == Idiomas.Italiano)
{
return "it";
}
else if (i == Idiomas.Frances)
{
return "fr";
}
else if (i == Idiomas.Portugues)
{
return "pt";
}
else
{
return "es";
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CognitiveServices.Translator.Client" version="1.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration" version="2.0.2" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.Abstractions" version="2.0.2" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.Binder" version="2.0.2" targetFramework="net461" />
<package id="Microsoft.Extensions.DependencyInjection" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Primitives" version="2.0.0" targetFramework="net461" />
<package id="NequeoBase" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoCollections" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoComponentModel" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoConversion" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoCryptography" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoCryptographyKey" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoData" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoDataLinq" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoExceptions" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoHandler" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoHttp" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoIOAudio" version="2016.26.1.2" targetFramework="net461" />
<package id="NequeoIOCompress" version="2016.26.1.2" targetFramework="net461" />
<package id="NequeoIOStream" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoLinq" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoModel" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoNet" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoNetClient" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoNetServiceModel" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoPrimitive" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoReflection" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoResource" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoSecurity" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoSerialisation" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoService" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoThreading" version="2016.26.1.1" targetFramework="net461" />
<package id="NequeoXml" version="2016.26.1.1" targetFramework="net461" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.4.0" targetFramework="net461" />
<package id="TranslatorService" version="1.1.2" targetFramework="net461" />
</packages>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment