本文整理汇总了C#中MonoDevelop.Gettext.CatalogEntry类的典型用法代码示例。如果您正苦于以下问题:C# CatalogEntry类的具体用法?C# CatalogEntry怎么用?C# CatalogEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CatalogEntry类属于MonoDevelop.Gettext命名空间,在下文中一共展示了CatalogEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CatalogEntry
public CatalogEntry (Catalog owner, CatalogEntry dt)
{
this.owner = owner;
str = dt.str;
plural = dt.plural;
hasPlural = dt.hasPlural;
translations = new List<string> (dt.translations);
references = new List<string> (dt.references);
autocomments = new List<string> (dt.autocomments);
isFuzzy = dt.isFuzzy;
isModified = dt.isModified;
isAutomatic = dt.isAutomatic;
hasBadTokens = dt.hasBadTokens;
moreFlags =dt.moreFlags;
comment = dt.comment;
validity = dt.validity;
errorString = dt.errorString;
}
示例2: Change
public Change (POEditorWidget widget, CatalogEntry entry, string oldText, string text, int index)
{
this.widget = widget;
this.Entry = entry;
this.OldText = oldText;
this.Text = text;
this.Index = index;
}
示例3: FailReason
public override string FailReason (CatalogEntry entry)
{
foreach (System.Text.RegularExpressions.Match match in Regex.Matches (entry.String, @"\{.\}", RegexOptions.None)) {
if (!entry.GetTranslation (0).Contains (match.Value))
return GettextCatalog.GetString ("Original string '{0}' contains '{1}', translation doesn't.", entry.String, match.Value);
}
return "";
}
示例4: UpdateEntry
public void UpdateEntry (CatalogEntry entry)
{
TreeIter iter, foundIter = TreeIter.Zero;
// Look if selected is the same - only wanted usecase
if (treeviewEntries.Selection.GetSelected (out iter)) {
CatalogEntry storeEntry = store.GetValue (iter, (int)Columns.CatalogEntry) as CatalogEntry;
if (entry.Equals (storeEntry))
foundIter = iter;
}
// Update data
if (foundIter.Stamp != TreeIter.Zero.Stamp) {
store.SetValue (foundIter, (int)Columns.Fuzzy, entry.IsFuzzy);
store.SetValue (foundIter, (int)Columns.Stock, GetStockForEntry (entry));
store.SetValue (foundIter, (int)Columns.RowColor, GetRowColorForEntry (entry));
store.SetValue (foundIter, (int)Columns.ForeColor, GetForeColorForEntry (entry));
}
}
示例5: SelectEntry
public void SelectEntry (CatalogEntry entry)
{
// if (updateThread.IsBusy)
// return;
TreeIter iter;
if (store.GetIterFirst (out iter)) {
do {
CatalogEntry curEntry = store.GetValue (iter, 4) as CatalogEntry;
if (entry == curEntry) {
this.treeviewEntries.Selection.SelectIter (iter);
TreePath iterPath = store.GetPath (iter);
if (!IsVisible (iterPath))
this.treeviewEntries.ScrollToCell (iterPath, treeviewEntries.GetColumn (0), true, 0, 0);
return;
}
} while (store.IterNext (ref iter));
}
store.AppendValues (GetStockForEntry (entry),
entry.IsFuzzy,
EscapeForTreeView (entry.String),
EscapeForTreeView (entry.GetTranslation (0)),
entry,
GetRowColorForEntry (entry),
GetTypeSortIndicator (entry),
GetForeColorForEntry (entry)
);
SelectEntry (entry);
}
示例6: GetTypeSortIndicator
static int GetTypeSortIndicator (CatalogEntry entry)
{
return entry.IsFuzzy ? 1 : entry.IsTranslated ? 0 : 2;
}
示例7: GetRowColorForEntry
Color GetRowColorForEntry (CatalogEntry entry)
{
if (entry.References.Length == 0)
return missing;
return entry.IsFuzzy ? fuzzy : entry.IsTranslated ? Style.Base (StateType.Normal) : untranslated;
}
示例8: EditEntry
void EditEntry (CatalogEntry entry)
{
this.isUpdating = true;
try {
currentEntry = entry;
this.texteditorOriginal.Caret.Location = new DocumentLocation (1, 1);
this.texteditorOriginal.Document.Text = entry != null ? entry.String : "";
this.texteditorOriginal.VAdjustment.Value = this.texteditorOriginal.HAdjustment.Value = 0;
// if (GtkSpell.IsSupported && !gtkSpellSet.ContainsKey (this.textviewOriginal)) {
// GtkSpell.Attach (this.textviewOriginal, "en");
// this.gtkSpellSet[this.textviewOriginal] = true;
// }
//
this.vbox8.Visible = entry != null && entry.HasPlural;
this.notebookTranslated.ShowTabs = entry != null && entry.HasPlural;
if (entry != null && entry.HasPlural) {
this.texteditorPlural.Caret.Location = new DocumentLocation (1, 1);
this.texteditorPlural.Document.Text = entry.PluralString;
this.texteditorPlural.VAdjustment.Value = this.texteditorPlural.HAdjustment.Value = 0;
// if (GtkSpell.IsSupported && !gtkSpellSet.ContainsKey (this.textviewOriginalPlural)) {
// GtkSpell.Attach (this.textviewOriginalPlural, "en");
// this.gtkSpellSet[this.textviewOriginalPlural] = true;
// }
}
this.foundInStore.Clear ();
if (entry != null) {
RemoveTextViewsFrom (entry.NumberOfTranslations);
for (int i = this.notebookTranslated.NPages; i < entry.NumberOfTranslations; i++) {
AddTextview (i);
}
for (int i = 0; i < entry.NumberOfTranslations; i++) {
Mono.TextEditor.TextEditor textView = GetTextView (i);
if (textView == null)
continue;
textView.ClearSelection ();
textView.Document.Text = entry != null ? entry.GetTranslation (i) : "";
textView.Caret.Offset = textView.Document.Text.Length;
textView.VAdjustment.Value = textView.HAdjustment.Value = 0;
textView.Document.CommitUpdateAll ();
}
foreach (string reference in entry.References) {
string file;
string line;
int i = reference.IndexOf (':');
if (i >= 0) {
file = reference.Substring (0, i);
line = reference.Substring (i + 1);
} else {
file = reference;
line = "?";
}
string fullName = System.IO.Path.Combine (System.IO.Path.GetDirectoryName (this.poFileName), file);
this.foundInStore.AppendValues (file, line, fullName, DesktopService.GetIconForFile (fullName, IconSize.Menu));
}
}
this.textviewComments.Buffer.Text = entry != null ? entry.Comment : null;
/* if (GtkSpell.IsSupported) {
foreach (TextView view in this.gtkSpellSet.Keys)
GtkSpell.Recheck (view);
}*/
} finally {
this.isUpdating = false;
}
}
示例9: EntryFails
public override bool EntryFails (CatalogEntry entry)
{
return entry.String.EndsWith (".") && !entry.GetTranslation (0).EndsWith (".");
}
示例10: OnEntry
protected override bool OnEntry (string msgid, string msgidPlural, bool hasPlural,
string[] translations, string flags,
string[] references, string comment,
string[] autocomments)
{
if (String.IsNullOrEmpty (msgid) && ! headerParsed) {
// gettext header:
catalog.ParseHeaderString (translations[0]);
catalog.Comment = comment;
headerParsed = true;
} else {
CatalogEntry d = new CatalogEntry (catalog, String.Empty, String.Empty);
if (! String.IsNullOrEmpty (flags))
d.Flags = flags;
d.SetString (msgid);
if (hasPlural)
d.SetPluralString (msgidPlural);
d.SetTranslations (translations);
d.Comment = comment;
for (uint i = 0; i < references.Length; i++) {
d.AddReference (references[i]);
}
for (uint i = 0; i < autocomments.Length; i++) {
d.AddAutoComment (autocomments[i]);
}
catalog.AddItem (d);
}
return true;
}
示例11: GetForeColorForEntry
Color GetForeColorForEntry (CatalogEntry entry)
{
if (entry.References.Length == 0)
return Styles.POEditor.EntryMissingBackgroundColor;
return entry.IsFuzzy ? Style.Black : entry.IsTranslated ? Style.Text (StateType.Normal) : Style.Black;
}
示例12: GetRowColorForEntry
static string iconMissing = "md-warning";//"md-translation-missing";
Color GetRowColorForEntry (CatalogEntry entry)
{
if (entry.References.Length == 0)
return Styles.POEditor.EntryMissingBackgroundColor;
return entry.IsFuzzy ? Styles.POEditor.EntryFuzzyBackgroundColor : entry.IsTranslated ? Style.Base (StateType.Normal) : Styles.POEditor.EntryUntranslatedBackgroundColor;
}
示例13: AddChange
public void AddChange (CatalogEntry entry, string oldText, string text, int index)
{
if (inUndoOperation)
return;
redoStack.Clear ();
undoStack.Push (new Change (this, entry, oldText, text, index));
}
示例14: RemoveEntry
void RemoveEntry (CatalogEntry entry)
{
bool yes = MessageService.AskQuestion (GettextCatalog.GetString ("Do you really want to remove the translation string {0} (It will be removed from all translations)?", entry.String),
AlertButton.Cancel, AlertButton.Remove) == AlertButton.Remove;
if (yes) {
TranslationProject project = IdeApp.ProjectOperations.CurrentSelectedSolutionItem as TranslationProject;
if (project != null) {
foreach (POEditorWidget widget in widgets)
widget.RemoveEntryByString (entry.String);
project.RemoveEntry (entry.String);
}
}
}
示例15: GetStockForEntry
static string GetStockForEntry (CatalogEntry entry)
{
if (entry.References.Length == 0)
return Gtk.Stock.DialogError;
return entry.IsFuzzy ? iconFuzzy : entry.IsTranslated ? iconValid : iconMissing;
}