How to localize parts of time in C# - localization

I want to add a label beside a spinner control to indicate the unit, eg, "hours" or "minutes" and have it localized to "horas" in Spanish or 小时 in Chinese automatically by the application (without having to add the label into a resource file).
What should I set the Text property of the label to?

Related

Managing paragraph Tab settings in a tRichEdit - Delphi

I am working with a tRichEdit component and using a tSpinedit to determine tab spacings using the trichedit.oncreate event to generate an array of tab positions to begin with. This is working fine and each new paragraph I generate uses the defined tab spacing. However, when using the SpinEdit1 Change event, I can change the tab spacing for the paragraph of text in which the cursor is placed, but it is not performing across the whole richedit text.
Is there a way to apply new tabstop settings across all of the paragraphs in a richedit document?
When I change the tab settings using tForm1.SpinEdit1Change, the tabs change for the current paragraph and subsequent ones, but previous paragraphs remain as they were. Is there a way to iterate through the paragraphs in the richedit1 content to change all of them in a 'for' loop? I have not found any array or list in the properties. Is there a property for setting the tabs globally at runtime or another approach that will accomplish this?
Select all paragraphs (from the very beginning to the end of the document) before setting the tab positions. You can select all paragraphs either manually, or programmatically with
RichEdit1.SelectAll;
Ref. documentation:
Vcl.ComCtrls.TCustomRichEdit.Paragraph
Paragraph formatting information includes alignment, indentation,
numbering, and tabs.
Paragraph is a read-only property, because a TCustomRichEdit object
has only one TParaAttributes object, which cannot be changed. The
attributes of the current paragraphs, however, can be changed, by
setting the properties of the TParaAttributes object.
The current paragraphs are the paragraphs that contain the selected
text. If no text is selected, the current paragraph is the one
containing the cursor.

Notepad++ plus plus Highlight content - highlight newly added data automatically

In a given paragraph as below I have highlighted Tom with StyleToken1
My name is Tom. I live on Earth.
Now, when I add more content to the file I want Tom should be highlighted automatically as new occurrences come in file. Is there a way to achieve this.
Thanks
You could define a User Define Language. Language -> Define your Language...
first tab: define some sane default for default text and background color,
second tab: enter Tom int 1st group textbox, define some color via the Styler button, probably you want to select prefix mode
Save As... (e.g. as Tom)
Now you can select Tom from the Language menun and occurrences of Tom should be colored as defined on the second tab.

Custom bulleted text in UITextView

I need square bulleted(colored) text as follows
◼︎ Some large amount of text that
make it span to the next line.
to be shown in UITextView. But the problem is it doesn't git the padding on the next line.
◼︎ Some large amount of text that
make it span to the next line.
These bulleted text is of static content and hence no need to set it through code.
Also custom font is not working when I set attributed type. Custom font used is Raleway.
You need to set up a ruler with a "hanging indent." I have no idea how to do this manually with text attributes.
I would suggest instead setting up what you want in a .rtf file and then loading an attributed string from the RTF using either initWithURL:options:documentAttributes:error: (which is only available in iOS 9 or later) or initWithData:options:documentAttributes:error: (which is available in iOS >= 7.0.)
You specify an options dictionary of
Objective-C:
#{NSDocumentTypeDocumentAttribute:NSRTFTextDocumentType}
Swift:
[NSDocumentTypeDocumentAttribute:NSRTFTextDocumentType]

Set default text size/color for text boxes in Master Slide PowerPoint 2013

I'm working with a PowerPoint document which annoyingly sets all newly inserted text boxes' color to Red and uses Century Gothic. I believe this is due to the Master Slide being used by the document.
I would like to remove this automatic setting from text boxes in the Master Slide but I cannot figure out how?
I have gone into the Master Slide view and found that there are no text physical text boxes, there are however "Text Placeholders" but no text boxes. I find it strange and wonder:
how are these newly inserted text boxes contain pre-set font type and color?
If you aren't trying to do this in code, StackOverflow isn't really the right place for the question; you want SuperUser for "How do I ..." questions that don't involve code.
But what you want to do is select a text box that's formatted the way you want default text to be, then right click it and choose Set As Default Text Box. You won't get that option if you've clicked WITHIN the text box and have an insertion cursor; in that case press ESC, then rightclick.
If you're trying to do this in code, select a text box formatted to taste then do something like this:
Sub SetMeAsDefault()
Dim oSh As Shape
Set oSh = ActiveWindow.Selection.ShapeRange(1)
With oSh
.SetShapesDefaultProperties
End With
End Sub
The shape and text box defaults are independent of master formatting, which controls only the formatting of placeholders and text within placeholders. Text/shapes inserted via the Insert ribbon/menu follow the defaults set for the presentation as I've described above. Each presentation (and template) can have its own set of defaults.

Write constraint to validate a field based on the value entered in another field in Orbeon Form Builder

I want to validate the size of the phone number field based on the selection made in the Phone Type field. Cell numbers should be 10 in size, Home and work numbers should be 11 in size. How would I write the constraint expression in Orbeon Form Builder. I tried using if in the constraint field, but was unsuccessful.
Thank you for your help!
Let's say you have two controls: a phone type and a phone number.
Create the phone type control, for instance as a drop-down or radio buttons. Give it a name, clicking on the cogwheel to open Edit Control Details. Say that name is phone-type. You will will refer later to the value selected by users as $phone-type.
Edit the items and keep in mind the value you assign to each item. The value is what you will use later, while the label is what is displayed to end users in the form. Say the values are work and mobile.
Create a single line control (text field), click on the red exclamation mark to open the Edit Validation Properties dialog, and there, under Constraint, write:
string-length(.) = (if ($phone-type = 'work') then 11 else 10)

Resources