Problem to Extending Localization Sources in abp v 6.3.0 - aspnetboilerplate

I need to extend localization sources.
According to the descriptions in the documentation,
I added the localization sources files in a folder named AbpWebXmlSource and marked embed.
After that, I registered them in the PreInitialize() method of module.
Configuration.Localization.Sources.Extensions.Add(
new LocalizationSourceExtensionInfo("AbpWeb",
new XmlEmbeddedFileLocalizationDictionaryProvider(
Assembly.GetExecutingAssembly(),
"HMS.Core.Localization.AbpWebXmlSource"
)
)
);
But unfortunately it does not work when used. Can anyone help me with this?

after a series of test I find the answer.
first must to added AbpWeb-fr.xml to abp.core project in any folder you want.
then need to get proprties of AbpWeb-fr.xml and convert it to embeded resource.
then must add this code to [your]coremodule.cs in preinitialize() method.
Configuration.Localization.Sources.Extensions.Add(
new LocalizationSourceExtensionInfo("AbpWeb",
new XmlEmbeddedFileLocalizationDictionaryProvider(
Assembly.GetExecutingAssembly(),
"" //important - this line need to fill empty string
)
)
);

Related

Problem with Objective-C marshalling an "optionals" property in Nativescript

I'm building a NativeScript plugin for iOS to integrate a card payment terminal as an external accessory. It is almost done, and working, but I have problem with passing one argument called "optionals". This is the whole code I'm trying to implement. It's the payworks framework for a Miura terminal. http://www.payworks.mpymnt.com/node/143
MPTransactionParameters *tp = [MPTransactionParameters chargeWithAmount:[NSDecimalNumber decimalNumberWithString:#"5.00"]
currency:MPCurrencyEUR
optionals:^(id<MPTransactionParametersOptionals> _Nonnull optionals) {
optionals.subject = #"Bouquet of Flowers";
optionals.customIdentifier = #"yourReferenceForTheTransaction";
}];
I cannot find a way of sending this "optionals" function.
In the generate typing metadata I see the MPTransactionParametersOptionals is a #protocol, but still don't know how to use it here as a parameter.
This is my current javascript code for the block
const tp = MPTransactionParameters.chargeWithAmountCurrencyOptionals(
amount,
MPCurrencyEUR,
function (optionals) {
console.log(optionals); //logs the newly created MPTransactionParameters instance, with set amount and currency properties, but cannot touch or set the optional properties.
}
);
The 3rd parameter of chargeWithAmountCurrencyOptionals() should be a function, but I'm doing it wrong, and searched everywhere in google how to do it but no success. I'm already trying for 2 days.
It is working, when the 3rd parameter is null, but I need the set the optional properties.
EDIT: adding the metadata. There are a lot of typings for MPtransactionParameters, so I decided to give you the whole file so you can search.
https://drive.google.com/open?id=1kvDoXtGbCoeCT20b9_t2stc2Qts3VyQx
EDIT2: Adding the typings:
https://drive.google.com/open?id=1lZ3ULYHbX7DXdUQMPoZeSfyEZrjItSOS

Getting the filename/path from MvvmCross Plugins.DownloadCache

I'm currently using MvvmCross DownloadCache -- and it's working alright -- especially nice when I just need to drop in an Image URL and it automagically downloads / caches the image and serves up a UIImage.
I was hoping to leverage the code for one other use case -- which is I'd like to grab source images from URL's and cache the files on the local file system, but what I really want for this other use case is the image path on the local file system instead of the UIImage itself.
What would help me most if I could get an example of how I might accomplish that. Is it possible to make that happen in a PCL, or does it need to go into the platform specific code?
Thanks -- that works, but just in case anyone else is following along, I wanted to document how I got the Mvx.Resolve<IMvxFileDownloadCache>() to work. In my setup.cs (in the touch project), I had:
protected override void InitializeLastChance ()
{
Cirrious.MvvmCross.Plugins.DownloadCache.PluginLoader.Instance.EnsureLoaded();
Cirrious.MvvmCross.Plugins.File.PluginLoader.Instance.EnsureLoaded();
Cirrious.MvvmCross.Plugins.Json.PluginLoader.Instance.EnsureLoaded();
...
}
But that wasn't enough, because nothing actually registers IMvxFileDownloadCache inside the DownloadCache plugin (which I was expecting, but it's just not the case).
So then I tried adding this line here:
Mvx.LazyConstructAndRegisterSingleton<IMvxFileDownloadCache, MvxFileDownloadCache>();
But that failed because MvxFileDownloadCache constructor takes a few arguments. So I ended up with this:
protected override void InitializeLastChance ()
{
...
var configuration = MvxDownloadCacheConfiguration.Default;
var fileDownloadCache = new MvxFileDownloadCache(
configuration.CacheName,
configuration.CacheFolderPath,
configuration.MaxFiles,
configuration.MaxFileAge);
Mvx.RegisterSingleton<IMvxFileDownloadCache>(fileDownloadCache);
...
}
And the resolve works okay now.
Question:
I do wonder what happens if two MvxFileDownloadCache objects that are configured in exactly the same way will cause issues by stepping on each other. I could avoid that question by changing the cache name on the one I'm constructing by hand, but I do want it to be a single cache (the assets will be the same).
If you look at the source for the plugin, you'll find https://github.com/MvvmCross/MvvmCross/blob/3.2/Plugins/Cirrious/DownloadCache/Cirrious.MvvmCross.Plugins.DownloadCache/IMvxFileDownloadCache.cs - that will give you a local file path for a cached file:
public interface IMvxFileDownloadCache
{
void RequestLocalFilePath(string httpSource, Action<string> success, Action<Exception> error);
}
You can get hold of a service implementing this interface using Mvx.Resolve<IMvxFileDownloadCache>()
To then convert that into a system-wide file path, try NativePath in https://github.com/MvvmCross/MvvmCross/blob/3.2/Plugins/Cirrious/File/Cirrious.MvvmCross.Plugins.File/IMvxFileStore.cs#L27

View source for Golang packages in LiteIDE

What's the easiest way to view source code of golang packages in LiteIDE?
for example, when there are code like this:
import "github.com/revel/revel"
func init() {
// Filters is the default set of global filters.
revel.Filters = []revel.Filter{
revel.PanicFilter, // Recover from panics and display an error page instead.
revel.RouterFilter, // Use the routing table to select the right Action
revel.FilterConfiguringFilter, // A hook for adding or removing per-Action filters.
revel.ParamsFilter, // Parse parameters into Controller.Params.
revel.SessionFilter, // Restore and write the session cookie.
revel.FlashFilter, // Restore and write the flash cookie.
revel.ValidationFilter, // Restore kept validation errors and save new ones from cookie.
revel.I18nFilter, // Resolve the requested language
HeaderFilter, // Add some security based headers
revel.InterceptorFilter, // Run interceptors around the action.
revel.CompressFilter, // Compress the result.
revel.ActionInvoker, // Invoke the action.
}
}
If I want to know what's the revel.PanicFilter really do, I would visit the http://github.com/revel/revel and seek the source code..
When using C++ (QtCreator), i would only need to ctrl+click then it would visit the declaration/implementation.
My Jump to declaration menu doesn't work in LiteIDE, maybe because the packages are compressed in .a archive?
file pkg/linux_amd64/github.com/revel/revel.a
pkg/linux_amd64/github.com/revel/revel.a: current ar archive
Is there an easier way to go to declaration to view the source just like in QtCreator?
F2 key jumps to the declaration of library function in Lite IDE v24.3
Ctrl+Shift+J works for me on LiteIDE 26. F2 doesnt work!

Xtext get the absolute path of the generated files

I want to access the file generated by Xtext to compile it automatically. So I need its absolute path. It's enough to get the absolute path of the current project at run-time. Any idea how I can get it?
I am working inside the "MyDslGenerator" Class. I tried to get it from the "resource" in
override void doGenerate(Resource resource, IFileSystemAccess fsa)
but couldn't find it.
Help is highly appreciated.
I ended up using this code:
var uri = (fsa as IFileSystemAccessExtension2).getURI(fileName)
maybe you can use the Interface org.eclipse.xtext.generator.IFileSystemAccessExtension2. the passed IFileSystemAccess may implement this interface too.

How can I add an MSBuild Import with IVsBuildPropertyStorage?

I'm trying to add an Import task to a .csproj file programmatically, but I don't want to use the Microsoft.Build.BuildEngine objects to do this because VS will then pop up warnings about the project file being modified from outside of Visual Studio.
I've seen a few pages [1] [2] suggesting that the IVsBuildPropertyStorage interface will let me access the MSBuild parts of the .csproj file, but I'm having trouble figuring out how to do this, or if it's even possible really. It looks like I need to specify the name of the property I want to access, but I'm not sure how to figure that out. Calling GetPropertyValue() for an "Import" property doesn't return anything for project files that are already set up how I want my final results to look:
EnvDTE.Project proj = ...;
var sol = Package.GetGlobalService(typeof(VsSolution)) as IVsSolution;
IVsHierarchy hier;
sol.GetProjectOfUniqueName(p.UniqueName, out hier);
var storage = hier as IVsBuildPropertyStorage;
string val;
storage.GetPropertyValue("Import", String.Empty,
(uint)_PersistStorageType.PST_PROJECT_FILE, out val);
// val is null
[1] https://mpfproj.svn.codeplex.com/svn/9.0/Tests/UnitTests/ProjectTest.cs
[2] http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/e1983591-120a-4a2f-a910-e596dd625e68
Thanks. I'd appreciate any suggestions I can get with this.
I asked a similar question see here Programmatically adding and editing the Targets in a Visual Studio Project File What you can do to add an import to the project file programmatically is to use this namespace http://msdn.microsoft.com/en-us/library/microsoft.build.construction.aspx which is from the assembly (in the GAC) Microsoft.Build.dll. You can accomplish this in about 3-4 steps:
the following is pseudo code:
Get the Project File location using the DTE.ActiveSolutionProjects and getting the Properties of each Project. Get the FullPath and the FileName to get the full path of the project file.
Once you have the full path of the project file, call the ProjectRootElement.Open static method:
ProjectRootElement project = ProjectRootElement.Open(projectPath);
Once you have the ProjectRootElement reference, you can call the AddImport method (where name is the Project Identifier Attribute):
project.AddImport(name)
That should do it.
Import element is not a Property element in MSBuild nor and Item one.
I think you can't add an Import using IVsBuildPropertyStorage.

Resources