GetUILanguages / SetCurrentUILang - when working with .manifest SOLVED
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
GetUILanguages / SetCurrentUILang - when working with .manifest
Hi support,
How should the SetCurrentUILang work when using .manifest for registration free usage?
I've tested and confirmed with FullDemo that there are no languages when Inst.GetUILanguages is called.
When working with the registered COM server - languages are listed - from where ?!?
p.s.
I see "Common\Languages" folders are mentioned here: viewtopic.php?f=66&t=32629&p=133702&hil ... ng#p133702
I thought I could get some language files, if they are needed, from https://www.pdf-xchange.com/langua ... nge-editor but this downloads a file that wants to install itself to Editor (and when it does there's still no "Languages" folder under "Common").
-žarko
How should the SetCurrentUILang work when using .manifest for registration free usage?
I've tested and confirmed with FullDemo that there are no languages when Inst.GetUILanguages is called.
When working with the registered COM server - languages are listed - from where ?!?
p.s.
I see "Common\Languages" folders are mentioned here: viewtopic.php?f=66&t=32629&p=133702&hil ... ng#p133702
I thought I could get some language files, if they are needed, from https://www.pdf-xchange.com/langua ... nge-editor but this downloads a file that wants to install itself to Editor (and when it does there's still no "Languages" folder under "Common").
-žarko
Re: GetUILanguages / SetCurrentUILang - when working with .manifest
The language packs, which you can download are simple zip archives. You can extract the files manually to any location you like.
I don't know about the SDK, but for the standard installation, the language files should be located in
C:\Program Files\Common Files\Tracker Software\Common\Languages (%CommonProgramFiles%\Tracker Software\Common\Languages).
older versions used "C:\Program Files\Tracker Software\Common\Languages".
I don't know about the SDK, but for the standard installation, the language files should be located in
C:\Program Files\Common Files\Tracker Software\Common\Languages (%CommonProgramFiles%\Tracker Software\Common\Languages).
older versions used "C:\Program Files\Tracker Software\Common\Languages".
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: GetUILanguages / SetCurrentUILang - when working with .manifest
Hi,
Thanks, this helped.
Anyhow, still, sdk related, the question: why does it work when not using the .manifest?
-žarko
Thanks, this helped.
Anyhow, still, sdk related, the question: why does it work when not using the .manifest?
-žarko
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: GetUILanguages / SetCurrentUILang - when working with .manifest
Hi support,
One more related question:
I've tried using AddDefaultTranslationData to load the translation from the file (xml).
This works, however, the UI language is switched to last added translation data.
And then calling SetCurrentUILang does nothing actually.
I could "fix" this by calling AddDefaultTranslationData each time when language needs to be changed - but I'm not sure that is the proper way - how it was envisioned / designed ?
p.s.
I'm trying to avoid the need to have "Strings.lng-Lng.xcl" in \Common\Languages folder. I'm storing the .xcl's as a resource in my exe and extracting as a resource into an Istream.
-ž
One more related question:
I've tried using AddDefaultTranslationData to load the translation from the file (xml).
This works, however, the UI language is switched to last added translation data.
And then calling SetCurrentUILang does nothing actually.
I could "fix" this by calling AddDefaultTranslationData each time when language needs to be changed - but I'm not sure that is the proper way - how it was envisioned / designed ?
p.s.
I'm trying to avoid the need to have "Strings.lng-Lng.xcl" in \Common\Languages folder. I'm storing the .xcl's as a resource in my exe and extracting as a resource into an Istream.
-ž
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: GetUILanguages / SetCurrentUILang - when working with .manifest
Hello zarkogajic,
Will forward this to Vasyl. Probably he can tell more.
Cheers,
Alex
Will forward this to Vasyl. Probably he can tell more.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: GetUILanguages / SetCurrentUILang - when working with .manifest
Hi žarko.
The AddDefaultTranslationData adds all your primary(default) built-in strings from the specified xml to the application's table of primary strings.
Each primary(default) string is the pair like { uniqueStrID, "<text>" }. For example:
such two rows declare two strings with str1 and str2 IDs and corresponding english text.
So, after adding such strings to the global application's string-registry via AddDefaultTranslationData, you will be able to use them in runtime:
// ***first method is better because such strings will be re-translated automatically when user changed the UI language
[/code]
Then if you want to make your strings localizable - you need to put some additional .xcl files to the ./Common/Languages folder. Each xcl-file must contain a translation for certain strings (the target language is specified in this file). For example:
./Common/Languages/abcd.de-DE.xcl
./Common/Languages/abcd.fr-FR.xcl
And finally:
HTH.
The AddDefaultTranslationData adds all your primary(default) built-in strings from the specified xml to the application's table of primary strings.
Each primary(default) string is the pair like { uniqueStrID, "<text>" }. For example:
Code: Select all
<Language eName="English" lName="English" code="-" R2L="false"/>
<Module name="PDFXEditor" namespace=""/>
<Strings>
...
<text id=str1'>First</text>
<text id='str2'>Second</text>
...
</Strings>
...
So, after adding such strings to the global application's string-registry via AddDefaultTranslationData, you will be able to use them in runtime:
Code: Select all
combo.InsertItem("$$$.str1"); // adds the "First"
combo.InsertItem("$$$.str2"); // adds the "Second"
or
combo.InsertItem(Inst.GetLocalStr("str1")); // adds the "First"
combo.InsertItem(Inst.GetLocalStr("str2")); // adds the "Second"
[/code]
Then if you want to make your strings localizable - you need to put some additional .xcl files to the ./Common/Languages folder. Each xcl-file must contain a translation for certain strings (the target language is specified in this file). For example:
./Common/Languages/abcd.de-DE.xcl
Code: Select all
...
<Language eName="German (Germany)" lName="Deutsch" code="de-DE" R2L="false"/>
<Module name="PDFXEditor" namespace="" />
<Strings>
...
<text id=str1'>Erste</text>
<text id='str2'>Zweite</text>
...
<Strings>
....
Code: Select all
...
<Language eName="French (France)" lName="Français" code="fr-FR" R2L="false"/>
<Module name="PDFXEditor" namespace="" />
<Strings>
...
<text id=str1'>Premier</text>
<text id='str2'>Deuxième</text>
...
<Strings>
....
Code: Select all
Inst.AddDefaultTranslationData(streamWithMyPrimaryStrings); // call it once only in the block of initializations
....
....
....
combo.InsertItem("$$$.str1"); // adds the "First"
combo.InsertItem("$$$.str2"); // adds the "Second"
....
....
Inst.SetCurrentUILang("de-DE");
// > now combo contains:
// Erste
// Zweite
....
....
Inst.SetCurrentUILang("fr-FR");
// > now combo contains:
// Premier
// Deuxième
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: GetUILanguages / SetCurrentUILang - when working with .manifest
Hi Vasyl,
Thanks.
It seems I'm then exploiting AddDefaultTranslationData to change default strings (and not add my own)
Is there any way to avoid the requirement to have non-english translations (of default English strings) be placed under "./Common/Languages/" on the file system?
Why are languages available when working with the registered dll and not when using .manifest?
What I'm doing at the moment and it seems to work: storing XCLs inside my exe as a resource. I've simply used the EN xcl from resources.dat and for other languages I've downloaded xcls. Then, when at run-time I want to change the UI language I'm extracting xcls to IStream and using it with AddDefaultTranslationData, then calling SetCurrentUILang.
Note that xcls contain default strings only - I'm not adding my own.
This seems to work, BUT I'm obviously calling AddDefaultTranslationData, for the same language (even for EN), multiple times. Example: switching languages from standard EN to FR, then EN, then FR again. This means I would be calling AddDefaultTranslationData for FR two times. How bad is that? I mean there are no errors and it does not seem to break something - but....
-ž
Thanks.
It seems I'm then exploiting AddDefaultTranslationData to change default strings (and not add my own)
Is there any way to avoid the requirement to have non-english translations (of default English strings) be placed under "./Common/Languages/" on the file system?
Why are languages available when working with the registered dll and not when using .manifest?
What I'm doing at the moment and it seems to work: storing XCLs inside my exe as a resource. I've simply used the EN xcl from resources.dat and for other languages I've downloaded xcls. Then, when at run-time I want to change the UI language I'm extracting xcls to IStream and using it with AddDefaultTranslationData, then calling SetCurrentUILang.
Note that xcls contain default strings only - I'm not adding my own.
This seems to work, BUT I'm obviously calling AddDefaultTranslationData, for the same language (even for EN), multiple times. Example: switching languages from standard EN to FR, then EN, then FR again. This means I would be calling AddDefaultTranslationData for FR two times. How bad is that? I mean there are no errors and it does not seem to break something - but....
-ž
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: GetUILanguages / SetCurrentUILang - when working with .manifest
Hello zarkogajic,
As Vasyl said, the AddDefaultTranslationData should only be called once, as it will spam a translation data vector with the same values again and again.
Basically, you will need to call the SetCurrentUILang, not the AddDefaultTranslationData every time.
Cheers,
Alex
As Vasyl said, the AddDefaultTranslationData should only be called once, as it will spam a translation data vector with the same values again and again.
Basically, you will need to call the SetCurrentUILang, not the AddDefaultTranslationData every time.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: GetUILanguages / SetCurrentUILang - when working with .manifest
Hi Alex,
It will not be doubled in the application's table of primary strings. Correct?
-ž
What happens internally when I call AddDefaultTranslationData with the same "uniqueStrID" for the same language two times?Each primary (default) string is the pair like { uniqueStrID, "<text>" }
It will not be doubled in the application's table of primary strings. Correct?
-ž
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: GetUILanguages / SetCurrentUILang - when working with .manifest
It replaces text for the existing strings with the same uniqueStrID.What happens internally when I call AddDefaultTranslationData with the same "uniqueStrID" for the same language two times?
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: GetUILanguages / SetCurrentUILang - when working with .manifest
Thanks Vasyl,
How about:
Why are languages available when working with the registered dll and not when using .manifest?
-ž
How about:
Why are languages available when working with the registered dll and not when using .manifest?
-ž
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: GetUILanguages / SetCurrentUILang - when working with .manifest
Strange, it should work well in both cases.. In case with the .manifest - have you the non-empty Common/Languages folder in the same location that contains the PDFXEditCore.x64/.x86.dll (that used by your app via manifest)? Can you double check by ProcessExplorer the location of PDFXEditCore module actually used by your app?
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: GetUILanguages / SetCurrentUILang - when working with .manifest
Hi Vasyl,
In the FullDemo sample app there's no ".\Commom\Languages" folder.
When building using .manifest the drop down to pick the language does *not* get populated.
When building with the registered (ole server) dll - languages *are* populated (?? from where)!
You should be able to reproduce this.
-ž
In the FullDemo sample app there's no ".\Commom\Languages" folder.
When building using .manifest the drop down to pick the language does *not* get populated.
When building with the registered (ole server) dll - languages *are* populated (?? from where)!
You should be able to reproduce this.
-ž
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: GetUILanguages / SetCurrentUILang - when working with .manifest
Hello zarkogajic,
As Vasyl said - you will need the ".\Commom\Languages" near the dll that's being used in the manifest - then everything will work for you. When you are using the registered dll, probably, you are using it from the installed SDK/Editor folder - there the ".\Commom\Languages" folder is present thus everything is working.
Cheers,
Alex
As Vasyl said - you will need the ".\Commom\Languages" near the dll that's being used in the manifest - then everything will work for you. When you are using the registered dll, probably, you are using it from the installed SDK/Editor folder - there the ".\Commom\Languages" folder is present thus everything is working.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: GetUILanguages / SetCurrentUILang - when working with .manifest SOLVED
Hi Alex,
Yes, that's it, thanks - there's ".\Commom\Languages" where EditorSDK is installed. Sorry, I do not see how I missed to see it.
-ž
Yes, that's it, thanks - there's ".\Commom\Languages" where EditorSDK is installed. Sorry, I do not see how I missed to see it.
-ž
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
GetUILanguages / SetCurrentUILang - when working with .manifest
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ