Esempio n. 1
0
        public AssemblyResultTS Sync(string assembly, string culture, string? @namespace = null)
        {
            Assembly    ass           = AssembliesToLocalize().Where(a => a.GetName().Name == assembly).SingleEx(() => "Assembly {0}".FormatWith(assembly));
            CultureInfo targetCulture = CultureInfo.GetCultureInfo(culture);

            CultureInfo defaultCulture = CultureInfo.GetCultureInfo(ass.GetCustomAttribute <DefaultAssemblyCultureAttribute>().DefaultCulture);

            var cultures = TranslationLogic.CurrentCultureInfos(defaultCulture);
            Dictionary <CultureInfo, LocalizedAssembly> reference = (from ci in cultures
                                                                     let la = DescriptionManager.GetLocalizedAssembly(ass, ci)
                                                                              where la != null || ci == defaultCulture || ci == targetCulture
                                                                              select KVP.Create(ci, la ?? LocalizedAssembly.ImportXml(ass, ci, forceCreate: ci == defaultCulture || ci == targetCulture))).ToDictionary();

            var master  = reference.Extract(defaultCulture);
            var target  = reference.Extract(targetCulture);
            var changes = TranslationSynchronizer.GetAssemblyChanges(TranslationServer.Translator, target, master, reference.Values.ToList(), null, @namespace, out int totalTypes);

            return(new AssemblyResultTS
            {
                totalTypes = totalTypes,
                cultures = cultures.Select(c => c.ToCulturesTS()).ToDictionary(a => a.name),
                types = changes.Types.Select(t => t.Type.Type.ToLocalizableTypeTS().Let(localizedTypes =>
                {
                    localizedTypes.cultures = cultures.ToDictionary(c => c.Name, c => GetLocalizedType(t, c, c.Equals(targetCulture)));
                    return localizedTypes;
                })).ToDictionary(lt => lt.type),
            });
        }
Esempio n. 2
0
        public ActionResult Index(Lite <RoleEntity> role)
        {
            var cultures = TranslationLogic.CurrentCultureInfos(CultureInfo.GetCultureInfo("en"));

            var assemblies = AssembliesToLocalize().ToDictionary(a => a.FullName);

            var dg = DirectedGraph <Assembly> .Generate(assemblies.Values, a => a.GetReferencedAssemblies().Select(an => assemblies.TryGetC(an.FullName)).NotNull());

            var dic = dg.CompilationOrderGroups().SelectMany(gr => gr.OrderBy(a => a.FullName)).ToDictionary(a => a,
                                                                                                             a => cultures.Select(ci => new TranslationFile
            {
                Assembly    = a,
                CultureInfo = ci,
                IsDefault   = ci.Name == a.GetCustomAttribute <DefaultAssemblyCultureAttribute>().DefaultCulture,
                FileName    = LocalizedAssembly.TranslationFileName(a, ci)
            }).ToDictionary(tf => tf.CultureInfo));


            if (role != null)
            {
                ViewBag.Role = role.InDB().Select(e => e.ToLite()).SingleEx();
            }

            return(base.View(TranslationClient.ViewPrefix.FormatWith("Index"), dic));
        }
Esempio n. 3
0
        public ActionResult Index()
        {
            var cultures = TranslationLogic.CurrentCultureInfos(TranslatedInstanceLogic.DefaultCulture);

            var list = TranslatedInstanceLogic.TranslationInstancesStatus();

            return(base.View(TranslationClient.ViewPrefix.FormatWith("IndexInstance"), list.AgGroupToDictionary(a => a.Type, gr => gr.ToDictionary(a => a.CultureInfo))));
        }
Esempio n. 4
0
        public TranslatedInstanceViewTypeTS View(string type, string?culture, string filter)
        {
            Type t = TypeLogic.GetType(type);
            var  c = culture == null ? null : CultureInfo.GetCultureInfo(culture);

            var master = TranslatedInstanceLogic.FromEntities(t);

            var support = TranslatedInstanceLogic.TranslationsForType(t, culture: c);

            var all = string.IsNullOrEmpty(filter);

            var cultures = TranslationLogic.CurrentCultureInfos(TranslatedInstanceLogic.DefaultCulture);

            Func <LocalizedInstanceKey, bool> filtered = li => all ||
                                                         li.RowId.ToString() == filter ||
                                                         li.Instance.Id.ToString() == filter ||
                                                         li.Route.PropertyString().Contains(filter, StringComparison.InvariantCultureIgnoreCase) ||
                                                         master.GetOrThrow(li).Contains(filter, StringComparison.InvariantCultureIgnoreCase) ||
                                                         cultures.Any(ci => (support.TryGetC(ci)?.TryGetC(li)?.TranslatedText ?? "").Contains(filter, StringComparison.InvariantCultureIgnoreCase));

            var sd = new StringDistance();

            var supportByInstance = (from kvpCult in support
                                     from kvpLocIns in kvpCult.Value
                                     where filtered(kvpLocIns.Key)
                                     let newText = master.GetOrThrow(kvpLocIns.Key)
                                                   group(lockIns: kvpLocIns.Key, translatedInstance: kvpLocIns.Value, culture: kvpCult.Key, newText: newText) by kvpLocIns.Key.Instance into gInstance
                                                   select KeyValuePair.Create(gInstance.Key,
                                                                              gInstance.AgGroupToDictionary(a => a.lockIns.RouteAndRowId(),
                                                                                                            gr => gr.ToDictionary(a => a.culture.Name, a => new TranslatedPairViewTS
            {
                OriginalText = a.translatedInstance.OriginalText,
                Diff = a.translatedInstance.OriginalText.Equals(a.newText) ? null : sd.DiffText(a.translatedInstance.OriginalText, a.newText),
                TranslatedText = a.translatedInstance.TranslatedText
            })
                                                                                                            ))).ToDictionary();

            return(new TranslatedInstanceViewTypeTS
            {
                TypeName = type,
                Routes = TranslatedInstanceLogic.TranslateableRoutes.GetOrThrow(t).ToDictionary(a => a.Key.PropertyString(), a => a.Value),
                MasterCulture = TranslatedInstanceLogic.DefaultCulture.Name,
                Instances = master.Where(kvp => filtered(kvp.Key)).GroupBy(a => a.Key.Instance).Select(gr => new TranslatedInstanceViewTS
                {
                    Lite = gr.Key,
                    Master = gr.ToDictionary(
                        a => a.Key.RouteAndRowId(),
                        a => a.Value
                        ),
                    Translations = supportByInstance.TryGetC(gr.Key) ?? new Dictionary <string, Dictionary <string, TranslatedPairViewTS> >()
                }).ToList()
            });
        }
    public static List <TranslatedTypeSummary> TranslationInstancesStatus()
    {
        var cultures = TranslationLogic.CurrentCultureInfos(DefaultCulture);

        return((from type in TranslateableRoutes.Keys
                from ci in cultures
                select new TranslatedTypeSummary
        {
            Type = type,
            CultureInfo = ci,
            State = ci.IsNeutralCulture && ci.Name != DefaultCulture.Name ? GetState(type, ci) : null,
        }).ToList());
    }
    public static TypeInstancesChanges GetTypeInstanceChangesTranslated(ITranslator[] translators, Type type, CultureInfo targetCulture, out int totalInstances)
    {
        var cultures = TranslationLogic.CurrentCultureInfos(TranslatedInstanceLogic.DefaultCulture);

        cultures.Remove(targetCulture);

        var instances = TranslatedInstanceLogic.GetInstanceChanges(type, targetCulture, cultures);

        totalInstances = instances.Count;
        if (instances.Sum(a => a.TotalOriginalLength()) > MaxTotalSyncCharacters)
        {
            instances = instances.Chunk(a => a.TotalOriginalLength(), MaxTotalSyncCharacters).First().ToList();
        }

        return(TranslateInstances(translators, type, targetCulture, instances));
    }
Esempio n. 7
0
        public List <TranslationFileStatus> GetState()
        {
            var cultures = TranslationLogic.CurrentCultureInfos(CultureInfo.GetCultureInfo("en"));

            var assemblies = AssembliesToLocalize().ToDictionary(a => a.FullName !);

            var dg = DirectedGraph <Assembly> .Generate(assemblies.Values, a => a.GetReferencedAssemblies().Select(an => assemblies.TryGetC(an.FullName !)).NotNull());

            var list = (from a in dg.CompilationOrderGroups().SelectMany(gr => gr.OrderBy(a => a.FullName))
                        from ci in cultures
                        select new TranslationFileStatus
            {
                assembly = a.GetName().Name !,
                culture = ci.Name,
                isDefault = ci.Name == a.GetCustomAttribute <DefaultAssemblyCultureAttribute>() !.DefaultCulture,
                status = CalculateStatus(a, ci)
            }).ToList();
Esempio n. 8
0
        public ActionResult SaveView(string assembly, string culture, string filter)
        {
            var currentAssembly = AssembliesToLocalize().Single(a => a.GetName().Name == assembly);

            List <TranslationRecord> list = GetTranslationRecords();

            if (culture.HasText())
            {
                LocalizedAssembly locAssembly = LocalizedAssembly.ImportXml(currentAssembly, CultureInfo.GetCultureInfo(culture), forceCreate: true);

                list.GroupToDictionary(a => a.Type).JoinDictionaryForeach(locAssembly.Types.Values.ToDictionary(a => a.Type.Name), (tn, tuples, lt) =>
                {
                    foreach (var t in tuples)
                    {
                        t.Apply(lt);
                    }
                });

                locAssembly.ExportXml();
            }
            else
            {
                Dictionary <string, LocalizedAssembly> locAssemblies = TranslationLogic.CurrentCultureInfos(CultureInfo.GetCultureInfo("en")).ToDictionary(ci => ci.Name,
                                                                                                                                                           ci => LocalizedAssembly.ImportXml(currentAssembly, ci, forceCreate: true));

                Dictionary <string, List <TranslationRecord> > groups = list.GroupToDictionary(a => a.Lang);

                list.GroupToDictionary(a => a.Lang).JoinDictionaryForeach(locAssemblies, (cn, recs, la) =>
                {
                    recs.GroupToDictionary(a => a.Type).JoinDictionaryForeach(la.Types.Values.ToDictionary(a => a.Type.Name), (tn, tuples, lt) =>
                    {
                        foreach (var t in tuples)
                        {
                            t.Apply(lt);
                        }
                    });

                    la.ExportXml();
                });
            }
            return(RedirectToAction("View", new { assembly = assembly, culture = culture, searchPressed = true, filter = filter }));
        }
Esempio n. 9
0
        public ActionResult View(string assembly, string culture, bool searchPressed, string filter)
        {
            Assembly ass = AssembliesToLocalize().Where(a => a.GetName().Name == assembly).SingleEx(() => "Assembly {0}".FormatWith(assembly));

            CultureInfo defaultCulture = CultureInfo.GetCultureInfo(ass.GetCustomAttribute <DefaultAssemblyCultureAttribute>().DefaultCulture);
            CultureInfo targetCulture  = culture == null ? null : CultureInfo.GetCultureInfo(culture);

            Dictionary <CultureInfo, LocalizedAssembly> reference = !searchPressed ? null :
                                                                    (from ci in TranslationLogic.CurrentCultureInfos(defaultCulture)
                                                                     let la = DescriptionManager.GetLocalizedAssembly(ass, ci)
                                                                              where la != null || ci == defaultCulture || ci == targetCulture
                                                                              select KVP.Create(ci, la ?? LocalizedAssembly.ImportXml(ass, ci, forceCreate: true))).ToDictionary();

            ViewBag.filter         = filter;
            ViewBag.searchPressed  = searchPressed;
            ViewBag.Assembly       = ass;
            ViewBag.DefaultCulture = defaultCulture;
            ViewBag.Culture        = targetCulture;

            return(base.View(TranslationClient.ViewPrefix.FormatWith("View"), reference));
        }
Esempio n. 10
0
        public ActionResult Sync(string assembly, string culture, bool translatedOnly, Lite <RoleEntity> role)
        {
            Assembly    ass           = AssembliesToLocalize().Where(a => a.GetName().Name == assembly).SingleEx(() => "Assembly {0}".FormatWith(assembly));
            CultureInfo targetCulture = CultureInfo.GetCultureInfo(culture);

            CultureInfo defaultCulture = CultureInfo.GetCultureInfo(ass.GetCustomAttribute <DefaultAssemblyCultureAttribute>().DefaultCulture);

            Dictionary <CultureInfo, LocalizedAssembly> reference = (from ci in TranslationLogic.CurrentCultureInfos(defaultCulture)
                                                                     let la = DescriptionManager.GetLocalizedAssembly(ass, ci)
                                                                              where la != null || ci == defaultCulture || ci == targetCulture
                                                                              select KVP.Create(ci, la ?? LocalizedAssembly.ImportXml(ass, ci, forceCreate: true))).ToDictionary();
            var master = reference.Extract(defaultCulture);

            var target = reference.Extract(targetCulture);

            DictionaryByTypeName(target); //To avoid finding duplicated types on save
            int totalTypes;
            var changes = TranslationSynchronizer.GetAssemblyChanges(TranslationClient.Translator, target, master, reference.Values.ToList(), role, null, out totalTypes);

            ViewBag.Role       = role;
            ViewBag.TotalTypes = totalTypes;
            ViewBag.Culture    = targetCulture;
            return(base.View(TranslationClient.ViewPrefix.FormatWith("Sync"), changes));
        }
Esempio n. 11
0
        public AssemblyResultTS Retrieve(string assembly, string culture, string filter)
        {
            Assembly ass = AssembliesToLocalize().Where(a => a.GetName().Name == assembly).SingleEx(() => "Assembly {0}".FormatWith(assembly));

            CultureInfo defaultCulture = CultureInfo.GetCultureInfo(ass.GetCustomAttribute <DefaultAssemblyCultureAttribute>().DefaultCulture);
            CultureInfo?targetCulture  = culture == null ? null : CultureInfo.GetCultureInfo(culture);

            var cultures = TranslationLogic.CurrentCultureInfos(defaultCulture);

            Dictionary <string, LocalizableTypeTS> types =
                (from ci in cultures
                 let la = DescriptionManager.GetLocalizedAssembly(ass, ci)
                          where la != null || ci == defaultCulture || ci == targetCulture
                          let la2 = la ?? LocalizedAssembly.ImportXml(ass, ci, forceCreate: true)
                                    from t in la2.Types.Values
                                    let lt = new LocalizedTypeTS
            {
                culture = ci.Name,
                typeDescription = new LocalizedDescriptionTS
                {
                    gender = t.Gender?.ToString(),
                    description = t.Description,
                    pluralDescription = t.PluralDescription,
                },
                members = t.Members.Select(kvp => new LocalizedMemberTS {
                    name = kvp.Key, description = kvp.Value
                }).ToDictionary(a => a.name),
            }
                 group lt by t.Type into g
                 select KVP.Create(g.Key.Name, g.Key.ToLocalizableTypeTS().Let(localizedTypes =>
            {
                localizedTypes.cultures = g.ToDictionary(a => a.culture);
                return(localizedTypes);
            })))
                .ToDictionaryEx("types");


            types.ToList().ForEach(lt => lt.Value.FixMembers(defaultCulture));

            if (filter.HasText())
            {
                var complete = types.Extract((k, v) => v.type.Contains(filter, StringComparison.InvariantCultureIgnoreCase) ||
                                             v.cultures.Values.Select(a => a.typeDescription !).Any(td =>
                                                                                                    td.description != null && td.description.Contains(filter, StringComparison.InvariantCultureIgnoreCase) ||
                                                                                                    td.pluralDescription != null && td.pluralDescription.Contains(filter, StringComparison.InvariantCultureIgnoreCase)));


                var filtered = types.Extract((k, v) =>
                {
                    var allMembers = v.cultures.Values.SelectMany(a => a.members.Keys).Distinct().ToList();

                    var filteredMembers = allMembers.Where(m => m.Contains(filter, StringComparison.InvariantCultureIgnoreCase) ||
                                                           v.cultures.Values.Any(lt => lt.members.GetOrThrow(m).description?.Contains(filter, StringComparison.InvariantCultureIgnoreCase) ?? false))
                                          .ToList();

                    if (filteredMembers.Count == 0)
                    {
                        return(false);
                    }

                    foreach (var item in v.cultures.Values)
                    {
                        item.members = item.members.Where(a => filteredMembers.Contains(a.Key)).ToDictionary();
                    }

                    return(true);
                });

                types = complete.Concat(filtered).ToDictionary();
            }

            return(new AssemblyResultTS
            {
                types = types.OrderBy(a => a.Key).ToDictionary(),
                cultures = cultures.Select(c => c.ToCulturesTS())
                           .ToDictionary(a => a.name)
            });
        }
Esempio n. 12
0
        public override void Execute()
        {
            #line 8 "..\..\Translation\Views\ViewInstance.cshtml"

            CultureInfo culture = ViewBag.Culture;
            Type        type    = ViewBag.Type;

            ViewBag.Title = TranslationMessage.View0In1.NiceToString().FormatWith(type.NiceName(), culture == null ? TranslationMessage.AllLanguages.NiceToString() : culture.DisplayName);

            Dictionary <LocalizedInstanceKey, string> master = ViewBag.Master;

            var cultures = TranslationLogic.CurrentCultureInfos(TranslatedInstanceLogic.DefaultCulture);

            Func <CultureInfo, bool> editCulture = c => culture == null || culture.Name == c.Name;

            var filter = (string)ViewBag.Filter;

            var all = string.IsNullOrEmpty(filter);

            Func <LocalizedInstanceKey, bool> filtered = li => all ||
                                                         li.RowId.ToString() == filter ||
                                                         li.Instance.Id.ToString() == filter ||
                                                         li.Route.PropertyString().Contains(filter, StringComparison.InvariantCultureIgnoreCase) ||
                                                         master.GetOrThrow(li).Contains(filter, StringComparison.InvariantCultureIgnoreCase) ||
                                                         cultures.Any(ci => (Model.TryGetC(ci)?.TryGetC(li)?.TranslatedText ?? "").Contains(filter, StringComparison.InvariantCultureIgnoreCase));


            #line default
            #line hidden
            WriteLiteral("\r\n");


            #line 31 "..\..\Translation\Views\ViewInstance.cshtml"
            Write(Html.ScriptCss("~/Translation/Content/Translation.css"));


            #line default
            #line hidden
            WriteLiteral("\r\n\r\n\r\n\r\n<h2>");


            #line 35 "..\..\Translation\Views\ViewInstance.cshtml"
            Write(ViewBag.Title);


            #line default
            #line hidden
            WriteLiteral("</h2>\r\n\r\n<div>\r\n");


            #line 38 "..\..\Translation\Views\ViewInstance.cshtml"


            #line default
            #line hidden

            #line 38 "..\..\Translation\Views\ViewInstance.cshtml"
            using (Html.BeginForm("View", "TranslatedInstance", FormMethod.Get))
            {
            #line default
            #line hidden

            #line 40 "..\..\Translation\Views\ViewInstance.cshtml"
                Write(Html.Hidden("type"));


            #line default
            #line hidden

            #line 40 "..\..\Translation\Views\ViewInstance.cshtml"



            #line default
            #line hidden

            #line 41 "..\..\Translation\Views\ViewInstance.cshtml"
                Write(Html.Hidden("culture"));


            #line default
            #line hidden

            #line 41 "..\..\Translation\Views\ViewInstance.cshtml"



            #line default
            #line hidden

            #line 42 "..\..\Translation\Views\ViewInstance.cshtml"
                Write(Html.TextBox("filter", filter));


            #line default
            #line hidden

            #line 42 "..\..\Translation\Views\ViewInstance.cshtml"
                ;



            #line default
            #line hidden
                WriteLiteral("        <input");

                WriteLiteral(" type=\"hidden\"");

                WriteLiteral(" name=\"searchPressed\"");

                WriteLiteral(" value=\"true\"");

                WriteLiteral(" />\r\n");

                WriteLiteral("        <input");

                WriteLiteral(" type=\"submit\"");

                WriteAttribute("value", Tuple.Create(" value=\"", 1786), Tuple.Create("\"", 1835)

            #line 45 "..\..\Translation\Views\ViewInstance.cshtml"
                               , Tuple.Create(Tuple.Create("", 1794), Tuple.Create <System.Object, System.Int32>(TranslationMessage.Search.NiceToString()

            #line default
            #line hidden
                                                                                                                 , 1794), false)
                               );

                WriteLiteral(" />\r\n");


            #line 46 "..\..\Translation\Views\ViewInstance.cshtml"
            }


            #line default
            #line hidden
            WriteLiteral("</div>\r\n\r\n");


            #line 49 "..\..\Translation\Views\ViewInstance.cshtml"
            if (Model == null)
            {
            #line default
            #line hidden
                WriteLiteral("    <em>");


            #line 51 "..\..\Translation\Views\ViewInstance.cshtml"
                Write(TranslationMessage.PressSearchForResults.NiceToString());


            #line default
            #line hidden
                WriteLiteral("</em>\r\n");


            #line 52 "..\..\Translation\Views\ViewInstance.cshtml"
            }
            else if (Model.IsEmpty())
            {
            #line default
            #line hidden
                WriteLiteral("    <strong>");


            #line 55 "..\..\Translation\Views\ViewInstance.cshtml"
                Write(TranslationMessage.NoResultsFound.NiceToString());


            #line default
            #line hidden
                WriteLiteral("</strong>\r\n");


            #line 56 "..\..\Translation\Views\ViewInstance.cshtml"
            }
            else
            {
                using (Html.BeginForm((TranslatedInstanceController c) => c.SaveView(Signum.Engine.Basics.TypeLogic.GetCleanName(type), culture == null ? null : culture.Name, filter)))
                {
            #line default
            #line hidden
                    WriteLiteral("        <table");

                    WriteLiteral(" id=\"results\"");

                    WriteLiteral(" style=\"width: 100%; margin: 0px\"");

                    WriteLiteral(" class=\"st\"");

                    WriteLiteral(">\r\n");


            #line 62 "..\..\Translation\Views\ViewInstance.cshtml"


            #line default
            #line hidden

            #line 62 "..\..\Translation\Views\ViewInstance.cshtml"
                    foreach (var instance in master.Keys.Where(li => master.GetOrThrow(li).HasText()).Where(filtered).GroupBy(a => a.Instance).OrderBy(a => a.Key.Id))
                    {
            #line default
            #line hidden
                        WriteLiteral("                <thead>\r\n                    <tr>\r\n                        <th");

                        WriteLiteral(" class=\"leftCell\"");

                        WriteLiteral(">");


            #line 66 "..\..\Translation\Views\ViewInstance.cshtml"
                        Write(TranslationMessage.Instance.NiceToString());


            #line default
            #line hidden
                        WriteLiteral("</th>\r\n                        <th");

                        WriteLiteral(" class=\"titleCell\"");

                        WriteLiteral(">");


            #line 67 "..\..\Translation\Views\ViewInstance.cshtml"
                        Write(Html.Href(Navigator.NavigateRoute(instance.Key), instance.Key.ToString()));


            #line default
            #line hidden
                        WriteLiteral("</th>\r\n                    </tr>\r\n                </thead>\r\n");


            #line 70 "..\..\Translation\Views\ViewInstance.cshtml"

                        foreach (LocalizedInstanceKey key in instance.OrderBy(a => a.Route.ToString()))
                        {
                            var propertyString = key.Route.PropertyString().Replace("/", "[" + key.RowId + "].");


            #line default
            #line hidden
                            WriteLiteral("                    <tr>\r\n                        <th");

                            WriteLiteral(" class=\"leftCell\"");

                            WriteLiteral(">\r\n");

                            WriteLiteral("                            ");


            #line 76 "..\..\Translation\Views\ViewInstance.cshtml"
                            Write(TranslationMessage.Property.NiceToString());


            #line default
            #line hidden
                            WriteLiteral("\r\n                    </th>\r\n                    <th>");


            #line 78 "..\..\Translation\Views\ViewInstance.cshtml"
                            Write(propertyString);


            #line default
            #line hidden
                            WriteLiteral("</th>\r\n                </tr>\r\n");


            #line 80 "..\..\Translation\Views\ViewInstance.cshtml"

                            foreach (var ci in cultures)
                            {
                                var formName = ci.Name + "#" + key.Instance.Key() + "#" + propertyString;

                                if (ci.Name == TranslatedInstanceLogic.DefaultCulture.Name)
                                {
            #line default
            #line hidden
                                    WriteLiteral("                            <tr>\r\n                                <td");

                                    WriteLiteral(" class=\"leftCell\"");

                                    WriteLiteral("><em>");


            #line 88 "..\..\Translation\Views\ViewInstance.cshtml"
                                    Write(TranslatedInstanceLogic.DefaultCulture);


            #line default
            #line hidden
                                    WriteLiteral("</em></td>\r\n                                <td");

                                    WriteLiteral(" class=\"monospaceCell\"");

                                    WriteLiteral(">\r\n");


            #line 90 "..\..\Translation\Views\ViewInstance.cshtml"


            #line default
            #line hidden

            #line 90 "..\..\Translation\Views\ViewInstance.cshtml"
                                    if (TranslatedInstanceLogic.RouteType(key.Route).Value == TranslateableRouteType.Html)
                                    {
            #line default
            #line hidden
                                        WriteLiteral("                                        <pre>");


            #line 92 "..\..\Translation\Views\ViewInstance.cshtml"
                                        Write(master[key]);


            #line default
            #line hidden
                                        WriteLiteral("</pre>\r\n");


            #line 93 "..\..\Translation\Views\ViewInstance.cshtml"
                                    }
                                    else
                                    {
            #line default
            #line hidden

            #line 96 "..\..\Translation\Views\ViewInstance.cshtml"
                                        Write(master[key]);


            #line default
            #line hidden

            #line 96 "..\..\Translation\Views\ViewInstance.cshtml"
                                    }


            #line default
            #line hidden
                                    WriteLiteral("                                    ");


            #line 98 "..\..\Translation\Views\ViewInstance.cshtml"
                                    Write(Html.TextArea(formName, master[key], new { style = "display:none" }));


            #line default
            #line hidden
                                    WriteLiteral("\r\n                                </td>\r\n                            </tr>\r\n");


            #line 101 "..\..\Translation\Views\ViewInstance.cshtml"
                                }
                                else
                                {
                                    TranslatedInstanceEntity trans = Model.TryGetC(ci)?.TryGetC(key);

                                    if (trans != null && editCulture(ci))
                                    {
            #line default
            #line hidden
                                        WriteLiteral("                                <tr>\r\n                                    <td");

                                        WriteLiteral(" class=\"leftCell\"");

                                        WriteLiteral(">");


            #line 109 "..\..\Translation\Views\ViewInstance.cshtml"
                                        Write(ci.Name);


            #line default
            #line hidden
                                        WriteLiteral(" Diff</td>\r\n                                    <td");

                                        WriteLiteral(" class=\"monospaceCell\"");

                                        WriteLiteral(">\r\n                                        <pre>");


            #line 111 "..\..\Translation\Views\ViewInstance.cshtml"
                                        Write(Signum.Web.Translation.TranslationClient.Diff(trans.OriginalText, trans.TranslatedText));


            #line default
            #line hidden
                                        WriteLiteral("</pre>\r\n                                    </td>\r\n                              " +
                                                     "  </tr>\r\n");


            #line 114 "..\..\Translation\Views\ViewInstance.cshtml"
                                    }


                                    if (trans != null || editCulture(ci))
                                    {
            #line default
            #line hidden
                                        WriteLiteral("                                <tr>\r\n                                    <td");

                                        WriteLiteral(" class=\"leftCell\"");

                                        WriteLiteral(">");


            #line 121 "..\..\Translation\Views\ViewInstance.cshtml"
                                        Write(ci.Name);


            #line default
            #line hidden
                                        WriteLiteral("</td>\r\n                                    <td");

                                        WriteLiteral(" class=\"monospaceCell\"");

                                        WriteLiteral(">\r\n");


            #line 123 "..\..\Translation\Views\ViewInstance.cshtml"


            #line default
            #line hidden

            #line 123 "..\..\Translation\Views\ViewInstance.cshtml"
                                        if (editCulture(ci))
                                        {
            #line default
            #line hidden

            #line 125 "..\..\Translation\Views\ViewInstance.cshtml"
                                            Write(Html.TextArea(formName, trans?.TranslatedText, new { style = "width:90%;" }));


            #line default
            #line hidden

            #line 125 "..\..\Translation\Views\ViewInstance.cshtml"
                                        }
                                        else if (TranslatedInstanceLogic.RouteType(key.Route).Value == TranslateableRouteType.Html)
                                        {
            #line default
            #line hidden
                                            WriteLiteral("                                            <pre>");


            #line 129 "..\..\Translation\Views\ViewInstance.cshtml"
                                            Write(trans.TranslatedText);


            #line default
            #line hidden
                                            WriteLiteral("</pre>\r\n");


            #line 130 "..\..\Translation\Views\ViewInstance.cshtml"
                                        }
                                        else
                                        {
            #line default
            #line hidden

            #line 133 "..\..\Translation\Views\ViewInstance.cshtml"
                                            Write(trans.TranslatedText);


            #line default
            #line hidden

            #line 133 "..\..\Translation\Views\ViewInstance.cshtml"
                                        }


            #line default
            #line hidden
                                        WriteLiteral("                                    </td>\r\n                                </tr>\r" +
                                                     "\n");


            #line 137 "..\..\Translation\Views\ViewInstance.cshtml"
                                    }
                                }
                            }
                        }
                    }


            #line default
            #line hidden
                    WriteLiteral("        </table>\r\n");

                    WriteLiteral("        <input");

                    WriteLiteral(" type=\"submit\"");

                    WriteAttribute("value", Tuple.Create(" value=\"", 6410), Tuple.Create("\"", 6457)

            #line 144 "..\..\Translation\Views\ViewInstance.cshtml"
                                   , Tuple.Create(Tuple.Create("", 6418), Tuple.Create <System.Object, System.Int32>(TranslationMessage.Save.NiceToString()

            #line default
            #line hidden
                                                                                                                     , 6418), false)
                                   );

                    WriteLiteral(" />\r\n");


            #line 145 "..\..\Translation\Views\ViewInstance.cshtml"
                }
            }


            #line default
            #line hidden
            WriteLiteral("\r\n\r\n<script>\r\n    $(function () {\r\n");

            WriteLiteral("        ");


            #line 151 "..\..\Translation\Views\ViewInstance.cshtml"
            Write(Signum.Web.Translation.TranslationClient.Module["fixTextAreas"]());


            #line default
            #line hidden
            WriteLiteral("\r\n    });\r\n</script>\r\n");
        }