ContainsLanguage() public static method

public static ContainsLanguage ( List texts, string language ) : bool
texts List
language string
return bool
Beispiel #1
0
        // Get the plural text for a symbol. Checks the eventDB for overrides to the symbol text; otherwise uses the default for the symbol.
        string GetSymbolPluralText(Symbol symbol, string gender, string nounCase = "")
        {
            Event  ev = eventDB.GetEvent();
            string id = symbol.Id;

            if (ev.customSymbolText.ContainsKey(id) && Symbol.ContainsLanguage(ev.customSymbolText[id], language))
            {
                return(Symbol.GetBestSymbolText(symbolDB, ev.customSymbolText[id], language, true, gender, nounCase));
            }
            else
            {
                return(symbol.GetPluralText(language, gender, nounCase));
            }
        }
Beispiel #2
0
        // Get the modified case for a symbol. Checks the eventDB for overrides to the symbol text; otherwise uses the default for the symbol.
        string GetSymbolModifiedCase(Symbol symbol)
        {
            Event  ev = eventDB.GetEvent();
            string id = symbol.Id;

            if (ev.customSymbolText.ContainsKey(id) && Symbol.ContainsLanguage(ev.customSymbolText[id], language))
            {
                return(Symbol.GetModifiedCase(symbolDB, ev.customSymbolText[id], language));
            }
            else
            {
                return(symbol.GetModifiedCase(language));
            }
        }
        // Get a regular 8-box line for a start or regular control.
        private DescriptionLine GetRegularLine(CourseView.CourseViewKind kind, int scoreColumn, CourseView.ControlView controlView, Dictionary <string, string> descriptionKey)
        {
            Event         ev      = eventDB.GetEvent();
            ControlPoint  control = eventDB.GetControl(controlView.controlId);
            CourseControl courseControl;

            if (controlView.courseControlIds[0].IsNone)
            {
                courseControl = null;
            }
            else
            {
                courseControl = eventDB.GetCourseControl(controlView.courseControlIds[0]);
            }

            Debug.Assert(control.kind == ControlPointKind.Normal || control.kind == ControlPointKind.Start || control.kind == ControlPointKind.MapExchange);

            DescriptionLine line = new DescriptionLine();

            line.kind  = DescriptionLineKind.Normal;
            line.boxes = new object[8];

            // Box A: ordinal or start triangle or points.
            if (control.kind == ControlPointKind.Start || control.kind == ControlPointKind.MapExchange)
            {
                line.boxes[0] = symbolDB["start"];
            }
            else if (kind != CourseView.CourseViewKind.AllControls && controlView.ordinal > 0)
            {
                line.boxes[0] = Convert.ToString(controlView.ordinal);
            }
            else
            {
                line.boxes[0] = null;
            }

            // Box B: code of the control
            if (control.kind == ControlPointKind.Normal)
            {
                line.boxes[1] = Convert.ToString(control.code);
            }

            // Boxes C-H, from the symbols
            for (int i = 2; i < 8; ++i)
            {
                String symbolID = control.symbolIds[i - 2];
                if (symbolID != null)
                {
                    line.boxes[i] = symbolDB[control.symbolIds[i - 2]];

                    // See if we need to add this to the key.
                    bool addToKey;
                    if (ev.customSymbolKey.TryGetValue(symbolID, out addToKey) && addToKey && Symbol.ContainsLanguage(ev.customSymbolText[symbolID], language))
                    {
                        descriptionKey[symbolID] = Symbol.GetBestSymbolText(symbolDB, ev.customSymbolText[symbolID], language, false, "", "");
                    }
                }
            }

            // Box F -- may be text instead of a symbol.
            if (control.columnFText != null)
            {
                Debug.Assert(line.boxes[5] == null);
                line.boxes[5] = control.columnFText;
            }

            // Put points in the score column, for a score course.
            if (control.kind == ControlPointKind.Normal && scoreColumn >= 0 && courseControl != null)
            {
                int points = courseControl.points;
                if (points > 0)
                {
                    line.boxes[scoreColumn] = Convert.ToString(courseControl.points);
                }
                else
                {
                    line.boxes[scoreColumn] = null;
                }
            }

            // Get the text version of the control using the Textifier.
            Textifier textifier = new Textifier(eventDB, symbolDB, language);

            line.textual = textifier.CreateTextForControl(controlView.controlId, "");

            // The course control ID, for use in coordinating the selection
            line.controlId       = controlView.controlId;
            line.courseControlId = controlView.courseControlIds[0];

            return(line);
        }