How to localize UI files in PySide - localization

I created an application which loads its UI dynamically from UI files (added to resources of application. I have't translate in with poyside-uic, loading as is. now I want lo localize application, but do not understand how.
I tried to generate TS file using pyside-lupdate widge1.ui widget2.ui ... -ts my.ts and got document with multiple context nodes and linguist does not shows all records (only about 7 records and I do not understand which exact).
So, my question: how to translate dynamically loaded UI files?

Found it. Quite simple, but not always obvious.
Execute pyside-lupdate file1.ui file2.ui .... fileN.ui -ts translations\ru_RU.ts. Got a TS file after that with multiple contexts (it is ok, I was wrong)
Open TS with linguist. Ensure that option 'Context' checked in menu "View->View"
...
PROFIT!!!

Related

Blazor Server localization

I have a project using Localization. program.cs:
builder.Services.AddLocalization();
...
app.UseRequestLocalization(new RequestLocalizationOptions()
.SetDefaultCulture(LanguageList.GetSupportedLanguages[0])
.AddSupportedCultures(LanguageList.GetSupportedLanguages)
.AddSupportedUICultures(LanguageList.GetSupportedLanguages));
Where LanguageList.GetSupportedLanguages is nothing but an array of CultureInfo.
It's working perfectly; however, I have put the .resx files in the same folder as the razor files and the folder content gets quite messy fast. If I move them, it doesn't work anymore.
I read in Microsoft doc that the Resource file path can be set by:
builder.Services.AddLocalization(config => config.ResourcesPath = "Resources");
However, if I move the resx files to this folder two things happen. It doesn't work (text is not set) and I get this error message:
Custom tool PublicResXFileCodeGenerator failed to produce an output for input file 'Resources\Index.en.resx' but did not log a specific error.
I been trying some tips I found here on StackOverflow, among them adjusting the folder structure to mimic the namespace.
No luck. What am I doing wrong here? How do I utilize the ResourcesPath setting?

Organize GraphQL files in directories in Rails

Upon running rails g graphql:install, a set of useful base type files are created in /app/graphql/types for us to extend when defining our own types. When running any of the generators, it creates these files in the same folder also. I set about creating sub directories thinking I could add some sense to this giant catch-all directory, but couldn't get things to load properly.
Since there is a base file for each type (base_enum.rb, base_object.rb, etc.), I created a folder for extensions of each of these types (enum_types, object_types, etc.). This broke auto loading though and I had to explicitly import these files to be able to use these custom types. So, at the top of query_type.rb, mutation_type.rb and app/graphql/mutations/base_mutation.rb I added the following:
['enum_typs', 'input_object_types', 'interface_types', 'object_types', 'scalar_types', 'union_types'].each do |dir|
Dir[File.dirname(__FILE__) + "/#{dir}/*.rb"].each {|file| require file }
end
This allowed things to run, but any change would break auto loading so I would have to restart the server on each change. I started reading through this article about auto loading on the rails site, but it was quite honestly a little over my head. Though it led me to believe I had to either find the correct names for my folders or namespace the objects defined in my type definition files properly to be able to do this.
Is there a sane way to organize these files in sub-directories which doesn't break auto loading? Do most projects just have a flat folder structure for these files?
Thank you!

Geocortex Workflow Designer Upload File

i was tring to create a workflow with geocortex workflow designer that upload a file in folder.
So to do that, i create a Form that make a file picker and it returns a IList of FileItem.
than i would take the base64 data and write a file, but it show me an error:
Geocortex.Forms.Client.FileItem.Friend Property FileDataBase64 As
String is not accessible in this context beacause it is 'Friend'
the scope of my variable its Flowchart and i can't understand why this error
this error is showned even if i try to access te variable inside the form activity even outside.
thank's every one
It is probably a security related issue.
Make sure that your target directory is writeable by Geocortex workflow. Do a very basic test.
Again do every steps of the process in isolation, in order to pin-point the source of the problem. Poliart.com

overriding front template translations doesn't work

I'm working on prestashop and I'm Trying to override "order detail page" in front (customer's details orders).
This is how I did :
I copied file \controllers\front\OrderDetailController.php into folder \override\controllers\front\OrderDetailController.php
I copied also default template file order-detail.tpl into folder override/customtemplate/order-detail.tpl
And In OrderDetailController.php I have specified template directory like that
$this->setTemplate(_PS_OVERRIDE_DIR_ . '/themes/parfum_evo/order-detail.tpl');
I tried, it works fine except translations. Even watching the documentation, no test solution seems to work.
Could anyone help me? Thank you in advance :'(
The php override sits in the correct place. As for the other, you specified the path the override/customtemplate/order-detail.tpl but then placed it in override/themes/parfum_evo/order-detail.tpl. I take it as customtemplate is farfum_evo really, but you need to add another one named themes, after override, using that structure. I think. Because there is a hook named
DisplayOverrideTemplate
Which should take care of this, while I believe setTemplate for controllers will always grab from the main theme folder

Rails 3.2 + CoffeeScript + Namespacing + Separate Files = Confusion

I have one companion script file for a Rails model, that uses code I've broken down into a hierarchy of over a dozen classes, for things like jQuery/Bootstrap UI code, factoring out similarities between different types of dialog, and so on. Let's say I'm working with articles.js.coffee as the "main page script" here.
I can define Coffeescript classes, namespace them as something like window.ourproject.OurUIDialog, and save them in separate, per-class source files such as app/assets/javascripts/OurUIDialog.js.coffee. Restart the Rails server, and that class can be subclassed, e.g., window.ourproject.PostInfoDialog extends window.ourproject.OurUIDialog. As long as PostInfoDialog is in articles.js.coffee (where the instantiation of the PostInfoDialog is), all is well.
But, if I move the subclass (PostInfoDialog) out into a separate file, e.g., PostInfoDialog.js.coffee, then attempting to do anything at all with it within the main articles script produces
Uncaught TypeError: Cannot read property 'prototype' of undefined
Again:
This revolves around a Rails model's companion script file, here called articles.js.coffee;
window.ourproject.OurUIDialog gets picked up whether it's in its own file or in articles.js.coffee
window.ourproject.PostInfoDialog (which extends OurUIDialog) can only be used if it's not in a separate file, even though viewing the generated HTML shows PostInfoDialog being included with all the other script files.
I'm tearing my hair out trying to figure this out, and I didn't have much left to begin with. Any ideas?
Pretty sure that Trevor Burnham answered my question when he answered this one; I just didn't see it the first dozen times I searched. :-P
Thanks to both of you for reading this one, though. :-)

Resources