protected bool CheckIncomingParameters()
        {
            // check that the root item is specified and exists
            // make sure the target language is different from the source language (as long as not adding all other languages)
            lblMessage.Visible = false;

            if (String.IsNullOrEmpty(txtItemPath.Text))
            {
                lblMessage.Visible = true;
                lblMessage.Text    = "Please enter a path.";
                return(false);
            }
            var rootItem = RootItem;

            if (rootItem == null)
            {
                lblMessage.Visible = true;
                lblMessage.Text    = "Cannot find root item: /sitecore" + txtItemPath.Text;
                return(false);
            }


            if ((Action != "DeleteTarget") && !AddAllOtherLanguages && SourceLanguage.Equals(TargetLanguage))
            {
                lblMessage.Visible = true;
                lblMessage.Text    = "Source and Target languages should not be identical";
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        public string Translate(string id)
        {
            if (SourceLanguage.Equals(CurrentLanguage))
            {
                return(id);
            }
            var result = InternalTranslate(m_CurrentLanguageLines, id);

            if (m_CurrentTranslit != null)
            {
                result = m_CurrentTranslit.Transliterate(result);
            }
            return(result);
        }