How translate button value with i18next? - i18next

Using
data-i18n="content.mytranslation"
The translation goes to the end of ">" of the button.
How can I translate the button value?

You can use data-i18n="[value]content.mytranslation" to insert value in button. You can change any element attribute using "[" "]"

Related

Adding text before and after selected text - VBA user form

I'm using a VBA user-form in order to edit some text by using a rich text format textbox from the InkEdit control.
I'm trying to insert html tags in specific location when the user click on a command button on the user-form.
for example if the user clicks the "strong" button the following code is executed and the text is inserted on the cursor location inside the textbox:
InkEdit1.SelText = "<strong>"
I have another button for the closing statment which runs:
InkEdit1.SelText = "</strong>"
I'm trying to find a way that the opening statement ans the closing statement will be applied together. When the user will select a text from the text box and click the button then "strong" will be inserted before the selection and "/strong" will be inserted after the selection:
Does this work:
InkEdit1.SelText = "<strong>" & InkEdit1.SelText & "</strong>"
If you really want to get fancy, you can reselect just the original text:
Dim lPos As Long
lPos = InkEdit1.SelStart
Dim lLength As Long
lLength = InkEdit1.SelLength
InkEdit1.SelText = "<strong>" & InkEdit1.SelText & "</strong>"
InkEdit1.SelStart = lPos + Len("<strong>")
InkEdit1.SelLength = lLength
Protip: Make sure the "HideSelection" property is set to "False"
If you're not using an actual RitchTextBox, try this: Toos > Additional Controls > check Microsoft Rich Textbox

Adding data to textbox/label from data grid view (vb.net)

i want to know the vb.net syntax to adding data to textbox or label. for example : "I Am Soldier" where the "I Am" text is from label and "Soldier" is the data that we took from data grid view
thank you
If your TextBox already contains the string "I Am" and you are trying to add another word to it, you would concatenate the strings.
TextBox.Text = TextBox.Text & " " & DataGridView.Rows(0).Cells(0).Value.ToString
Some people like to shorthand this using the &= assignment operator.
TextBox.Text &= " " & DataGridView.Rows(0).Cells(0).Value.ToString
If your TextBox is empty you simply assign that value literally.
TextBox.Text = "I Am " & DataGridView.Rows(0).Cells(0).Value.ToString

Issue setting returned text to variable within repeat loop - OS X 10.9.x

The goal of this script is to:
Ask the user how many text replacement (System Preferences>Keyboard>Text) shortcuts they'd like to have. The text returned is set to my variable "gTextReplacementNum" as number. See my second handler "HowMany()"
Have the user provide the text replacement shortcut and the text to do the replacing for the number of shortcuts they wanted. See my third handler "GetText()"
Take the user provided text contained in a variable to create a new AppleScript doc that does all the heavy lifting for them. Code not yet written; not within scope of question.
Then they have a personalized AppleScript Application Bundle they may launch on their Mac to auto-populate the text replacement preferences pane.
I am having trouble getting this to work properly. I need the loop to keep adding the answers to a variable as a list or to a variable that increments its name according to the loop instance (e.g. TextReturned_i, TextReturned_i+1, etc).
Have I adequately explain this?
global gTextReplacementNum
set gTextReplacementNum to 0
# Main Logic Begins
try
Start()
HowMany()
GetText()
on error errText number errNum
display alert "Error " & errNum message errText
end try
# Main Logic Ends
# Handlers Begin
-- First Handler
on Start()
display alert "Automated Text Replacement v1.0" message "Created by: Me
myemail#domain.com" buttons {} giving up after 4
display alert "About" message "This app will have you provide a text 'short cut' to replace with and replacement text. It then compiles all this into an application that can be run on any Mac.
Would you like to continue?" buttons {"No", "Yes"} cancel button 1 default button 2
end Start
-- Second Handler
on HowMany()
display dialog "How many text replacement shortcuts would you like?
Please enter numericals only. (1, 2, 3)" default answer "" buttons {"Cancel", "Okay"} default button 2 cancel button 1
copy the result as list to {ButtonPressed, TextReturned}
set gTextReplacementNum to TextReturned as number
end HowMany
-- Third Handler
on GetText()
repeat with i from 1 to gTextReplacementNum as number
display dialog "What text would you like to replace?
(this is your shortcut)" default answer "" buttons {"Cancel", "Okay"} default button 2 cancel button 1
set TextShortcut to text returned of result as list
display dialog "What is the replacement text?
(this is what the shortcut fills out)" default answer "" buttons {"Cancel", "Okay"} default button 2 cancel button 1
set TextReplaced to text returned of result as list
end repeat
end GetText
# Handlers End
In your GetText() handler, you are replacing the value TextShortcut and TextReplaced each time. You need to
set aList to aList & newValue
to build a list in a repeat loop.
Also, as is, this handler never returns the value of these two lists. So, I'd suggest, using your scheme, make these two variables globals as well.
So, the full changes are:
1. Add to the declarations:
global gTextReplacementNum
global gTextShortcut
global gTextReplaced
set gTextReplacementNum to 0
set gTextShortcut to {}
set gTextReplaced to {}
and 2. edit your GetText() handler:
-- Third Handler
on GetText()
repeat with i from 1 to gTextReplacementNum as number
display dialog "What text would you like to replace?
(this is your shortcut)" default answer "" buttons {"Cancel", "Okay"} default button 2 cancel button 1
set gTextShortcut to gTextShortcut & (text returned of result)
display dialog "What is the replacement text?
(this is what the shortcut fills out)" default answer "" buttons {"Cancel", "Okay"} default button 2 cancel button 1
set gTextReplaced to gTextReplaced & (text returned of result)
end repeat
end GetText
An alternate method would be to read a tab delim file and work from that with a standard script. Something like:
property fileName : "shortcuts.txt"
set filePath to (path to desktop as string) & fileName
set theData to read file filePath
set theRecords to paragraphs of theData
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to tab
repeat with thisPair in theRecords
set {theShortcut, theReplacement} to text items of thisPair
setKeyboardPref(theShortcut, theReplacement)
end repeat
set AppleScript's text item delimiters to oldDelim
on setKeyboardPref(theShortcut, theReplacement)
-- set up the pair
display dialog theShortcut & return & theReplacement
end setKeyboardPref

ComboBox.Text to Label.Text

The project is an alarm clock and the comboboxes select the alarm time which i want to print to label4 in the format hr:min:sec AM/PM
i need to copy the value the is selected in my comboboxes and print them into a label with the format hr:min:sec AM/PM. This is what i have:
Label4.Text = (ComboBox1.SelectedText) & ":" & (ComboBox2.SelectedText) & ":"(ComboBox3.SelectedText) & " " & (ComboBox4.SelectedText)
' the rest of the combo boxes are similar
ComboBox1.Items.Add("1")
ComboBox1.Items.Add("2")
ComboBox1.Items.Add("3")
ComboBox1.Items.Add("4")
ComboBox1.Items.Add("5")
ComboBox1.Items.Add("6")
ComboBox1.Items.Add("7")
ComboBox1.Items.Add("8")
ComboBox1.Items.Add("9")
ComboBox1.Items.Add("10")
ComboBox1.Items.Add("11")
ComboBox1.Items.Add("12")
'ComboBox1.SelectedIndex = vari1
ComboBox1.Update()
Just as you said yourself in the title, you should be using Text, not SelectedText. SelectedText is NOT the same as SelectedItem. It's the same as the similarly-named property of a TextBox, i.e. the part of the text that is highlighted. You're also missing an &, but that's not your core issue.

DataGridViewButtonColumn

I have a DataGridViewButton and I would like to hide or remove the text of a button when a condition is true. Is it possible, or anyone have any workaround to get to it.
You can set the button text to a space by setting that cell's value to a space.
DataGridView1.Rows(rowNum).Cells(colNum).Value = " "