I just created a properties file where I store my text.
In this SAP Walkthrough
for SAPUI5 the wrote the code like this
showHelloButtonText=Say Hallo
helloMsg=Hello {0}
The {0} is for the case that I want to set more parameters. But now the pop-up also displays the {0}. So the output is:
Hello {0}
The properties file is just a "File" in eclipse with the suffix ".properties", if this could help.
Thanks for any hints :)
Final result can be seen here: http://plnkr.co/edit/OGmJimjF2YZ46mv6DsF2?p=preview
What I did was the following:
When you want to bind a String with placeholders to a control in a view, you have to provide a formatter.
The formatter takes the placeholder String (Hello {0}) and the filler String and combines them
formatMsg: function(sMsg, sValue) {
return jQuery.sap.formatMessage(sMsg, sValue);
}
This formatter has to be called when your element is rendered, so you have to add it to your binding
<Label text="{
parts:[
{path:'i18n>helloMsg'},
{path:'/recipient/name'}
], formatter:'.formatMsg'}"
/>
The formatter takes two arguments, so we have to provide two values: The placeholder String and the value of the model.
The example in SAPs Walkthrough shows you both ways how to set the text of your message.
The first would be a static text, defined by:
helloMsg = Hello
The second option would be to use the {} brackets. This is a reference to different language options saved within a file in your workspace.
When you change the language of your browser it will then display different languages as set in your file.
Related
I would like to create a "cleanup" extension that replaces various characters (quotes by guillemets) in all kinds of textfields in TYPO3.
I thought about extending <f:format.html> or parseFunc, but I don't know where to "plug in" so I get to replace output content easily before it's cached.
Any ideas, can you give me an example?
If you don't mind regexing, try this:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['cleanUpQuotes'][] = \NAMESPACE\Your\Extension::class;
Insert it into ext_localconf.php and this part is done.
The next step is the class itself:
public function cleanUpQuotes(TypoScriptFrontendController $parentObject)
{
$parentObject->content = DO_YOUR_THING_HERE
}
There also is another possibility which could replace any strings in the whole page - as it operates on the rendered page (and not only on single fields).
You even can use regular expressions.
Look at my answer -> here
I would like to create a personalize PCB template (Title block) for my company which include company information and logo. So I wanted to know how can I use or edit existing PCB sheet templates according to my needs?
Pariksit.
THIS ISN'T A QUESTION ABOUT PROGRAMMING. I'll answer but don't worry if someone delete the question.
I like to create my own title blocks. You can do that creating a schematic component and introducing the parameters you want.
In your schematic library, add a new component called Title_Block. Use lines and strings to create the fields.
I put these strings in red to show that are special strings starting with '=' sign.
These special strings will be replaced automatically by Altium when you create a parameters with the same name. I put some Altium default parameters (SheetNumber, SheetTotal, CurrentDate and Title) and two that we'll create (VersionRevision and Project). You can see other default special strings here: Schematic Text Strings.
In your schematic sheet, disable the Title Block to introduce yours. Right click on the schematic, Options > Sheet..., and uncheck the Title Block box.
Create your own parameters on Project > Project Options tab Parameters like this:
Now, when you add the component called _Title_Block it seems like this:
In Schematic Page,
Design->Project Template ->Choose a File
Now, following location will be open.
C:\Users\Public\Documents\Altium\AD16\Templates
Here, you can find like A3,A4 different template for Schematic and PCB also.
You can Edit that as per requirement.
To Edit or Change the logo in Template sheet:
Place->Drawing tool->Graphic.
My question is : how to use the view identifier as parameter?
Code example:
Dim DrwDocument As DrawingDocument
Set DrwDocument = CATIA.ActiveDocument
Dim iParameter As Parameter
Set iParameter = DrwDocument.Parameters.Item("Drawing\Sheet.1\ViewMakeUp.1\Scale")
MyText.InsertVariable 0, 0, iParameter
but how can i access to the view identifier, and use it as parameter?
thank you!
Ok, do do this you must first create a parameter in the DrawingDocument object.
So you would have something like this added to your current code:
Dim IndetifierParam as Parameter
Set IdentifierParam = MyDrawingDocument.Parameters.CreateString("ViewIdentifier", "A")
MyText.Text = "View ID: "'note: there are two spaces from last character to end of the quote
MyText.InsertVariable Len(MyText.Text),0,IdentifierParam 'First parameter is insert position, second parameter is how many characters to overwrite, third is the parameter.
Now, in the drawing tree on the left you will see a Parameter Set with your new String Parameter. Double click the parameter and edit it...The drawing test will automatically update the drawing text with the changed parameter value. ALSO, as an added benefit, it's much easier in a VBA script to modify a parameter than the drawing text.
How to update or change this new Parameter:
IdentifierParam.ValuateFromString "A" 'add a string or variable here
Lastly, an extra tip, Go to Tools -> Options and click Parameters and Measure from the tree and on the First tab "Knowledge" check "With Value" and "With Formula" They are the first two checkboxes.
Im localizing my GWT app, and I want to localize the context menu in my listgrid (SmartGWT). According to the doc, I can set the title of group/ungroup by:
http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/widgets/grid/ListGrid.html#setGroupByText(java.lang.String)
public void setGroupByText(String groupByText)
This is a dynamic string - text within \${...} will be evaluated as JS code when the message is displayed, with title available as a variable containing the field title. Default value returns "Group by " + the field's summary title.
I want to put "Group by XXX" (in different languages), where XXX is the column title, and I should be able to do that with a dynamic string, which evaluates the JS title variable. But how? I need a concrete example, such as:
list.setGroupByText("GROUP BY \\${title}"); // DOES NOT WORK!!!
list.setGroupByText("GRUPPÉR MED \\${title}"); // DOES NOT WORK!!!
Any suggestions?
Ok, I might be very stupid. Here's the answer:
list.setGroupByText("Group by ${title}");
So, in danish that would be:
list.setGroupByText("Gruppér efter ${title}");
How to use localized default values for parameters in iReport?
Using a $R{message.key} as the parameter default value has negative consequences in the "Read fields" functionality of iReport's SQL editor. More precisely, the following error is shown (after pressing the Read fields button in Report query dialog):
Sourced file: inline evaluation of: ``$R{message.key}'' : Attempt to access property on undefined variable or class name
Any way around this iReport problem?
Here is the image to illustrate the problem:
I think this is a iReport's bug.
You can temporary comment the defaultValueExpression expression and add the fields via the Report query -> Read fields button.
Or you can manually add the fields declaration.
This is iReport bug ! To solve this issue please follow the below steps.
Open XML File
Remove defaultValueExpression tag value.