Secondary lng with own changes

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

oko
Senior Member
Senior Member
Posts: 200
Joined: 2007-05-03, 16:22 UTC

Secondary lng with own changes

Post by *oko »

I would like to suggest to add option to choose secondary lng, for example with user changes. So it would be possible to choose not only official translation lng file but also the own lng file. Now there is option to choose own lng file, but only if tc stays in english.
Tc would get items first from secondary lng (user), then from primary lng (translation) and finally from internal english.
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3278
Joined: 2003-05-06, 11:46 UTC

Re: Secondary lng with own changes

Post by *Sir_SiLvA »

oko wrote: 2023-05-24, 10:19 UTC I would like to suggest to add option to choose secondary lng, for example with user changes. So it would be possible to choose not only official translation lng file but also the own lng file. Now there is option to choose own lng file, but only if tc stays in english.
Tc would get items first from secondary lng (user), then from primary lng (translation) and finally from internal english.
#1 TC allready does allready Tc would get items first from translation and finally from internal english. if strings are missing from the translation
#2 why not just change the translation file, or even ask the author of that translation for changes? :D
Hoecker sie sind raus!
oko
Senior Member
Senior Member
Posts: 200
Joined: 2007-05-03, 16:22 UTC

Re: Secondary lng with own changes

Post by *oko »

Sir_SiLvA wrote: 2023-05-24, 10:34 UTC
oko wrote: 2023-05-24, 10:19 UTC I would like to suggest to add option to choose secondary lng, for example with user changes. So it would be possible to choose not only official translation lng file but also the own lng file. Now there is option to choose own lng file, but only if tc stays in english.
Tc would get items first from secondary lng (user), then from primary lng (translation) and finally from internal english.
#1 TC allready does allready Tc would get items first from translation and finally from internal english. if strings are missing from the translation
#2 why not just change the translation file, or even ask the author of that translation for changes? :D
#1 I know tc does it so (lng then internal), but if I want have translation choosen in setting, I can not choose own lng. Am I right?
#2a because If new tc version is released, I have to find and edit items again in new lng file
#2b because translator does not do each change which I want, resp. some of my changes are specific and I can not require to change it for all.
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3278
Joined: 2003-05-06, 11:46 UTC

Re: Secondary lng with own changes

Post by *Sir_SiLvA »

oko wrote: 2023-05-24, 10:47 UTC #2a because If new tc version is released, I have to find and edit items again in new lng file
No only if new strings are added that have wordings you find unclear and its not like a) TC brings out a new version every month and
b) adds lots of new strings each time.

For example: if your prefered language in tc is spanish, rename the files (with multirename tool :D )
from WCMD_ESP.INC, WCMD_ESP.LNG, and WCMD_ESP.MNU to WCMD_OKO_ESP.INC, WCMD_OKO_ESP.LNG, and WCMD_OKO_ESP.MNU
(its important that these files end on the language in this case _ESP) and edit the WCMD_OKO_ESP.LNG however you like.
And the best part about doint it this way: when there is a new TC version your files wont get overwritten and will still be used.
(oh and this way you can also Edit the Menu-file cause its mising A LOT :-))
Hoecker sie sind raus!
User avatar
petermad
Power Member
Power Member
Posts: 14741
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Secondary lng with own changes

Post by *petermad »

I can understand the reason for wanting this feature. Imagine that you like like to always use:
677=""
in stead of
677="<DIR>"

and you are NOT using internal English - Currently you have to manually edit your current language file (for example wcmd_deu.lng) every time a new version of TC is released. Imagine that you have 20 or 40 of such userdefined changes - that is a lot of work changing all that.

So if TC would always look first in wcmd_user.lng (as a new reserved file name) for the translation, then in wcmd_deu.lng and finally in internal English - that would be a nice feature.

It would simply be extending the current functionality of using a partial wcmd_eng.lng file together with Internal English, to work for other languages too.

Regarding the .inc file the same could be applied - if a wcmd_user.lng file exist, first look for and in wcmd_user.inc for translation of command descriptions.

Regarding the .mnu file TC should still automatically use wcmd_deu.mnu if wcmd_deu.lng is chosen - the menu file is not indexed so a wcmd_user.mnu file does not make sence here - and the user can always (also currently) choose a .mnu file with another name than the .lng file.

Regarding the .ini file there is no need for a wcmd_user.ini file to supplement a wcmd_deu.ini file - we already have the usercmd.ini file for that.

So support++
Last edited by petermad on 2023-05-24, 14:15 UTC, edited 1 time in total.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
oko
Senior Member
Senior Member
Posts: 200
Joined: 2007-05-03, 16:22 UTC

Re: Secondary lng with own changes

Post by *oko »

Sir_SiLvA wrote: 2023-05-24, 11:33 UTC
- if new tc version is released, it includes new lng file and it dont depend on how much changes are in new lng file, but how much changes are my own, which I must "transfer" or "rechange" from old to new lng.
- rename lng file is not solution, because I always want have actual lng file but with my own changes. I dont need preserve old lng file.
Sob
Power Member
Power Member
Posts: 941
Joined: 2005-01-19, 17:33 UTC

Re: Secondary lng with own changes

Post by *Sob »

Your mistake is doing it manually, that's annoying. Let the machines do the work! :)

Code: Select all

var strings = {
  1519: '%s / %s v %s / %s souborech',
  1520: ' z ',
  1521: ' volných',
  1522: ' a %s / %s složek'
};

var fso = WScript.CreateObject('Scripting.FileSystemObject');
var inFile = fso.OpenTextFile('WCMD_CZ.LNG', 1);
var outFile = fso.CreateTextFile('WCMD_CZ_custom.LNG', true);
var line, aux;
while(!inFile.AtEndOfStream) {
  line = inFile.ReadLine();
  if((aux = line.match(/^(\d+)=/)) && strings.hasOwnProperty(aux[1])) {
    outFile.WriteLine(aux[1] + '="' + strings[aux[1]] + '"');
  } else {
    outFile.WriteLine(line);
  }
}
inFile.Close();
outFile.Close();
Write your strings at the beginning, save it as langfix.js in TC's LANGUAGE directory, run it using "wscript langfix.js" and you'll get new WCMD_CZ_custom.LNG with your strings changed. Only needed once after each update, that's bearable.
oko
Senior Member
Senior Member
Posts: 200
Joined: 2007-05-03, 16:22 UTC

Re: Secondary lng with own changes

Post by *oko »

Sob wrote: 2023-05-25, 01:04 UTC Write your strings at the beginning, save it as langfix.js in TC's LANGUAGE directory, run it using "wscript langfix.js" and you'll get new WCMD_CZ_custom.LNG with your strings changed. Only needed once after each update, that's bearable.
Maybe I try. What and where is "wscript langfix.js"? How to run?
Sob
Power Member
Power Member
Posts: 941
Joined: 2005-01-19, 17:33 UTC

Re: Secondary lng with own changes

Post by *Sob »

langfix.js - file you'd save posted code as (or whatever name you like)
wscript - built-in thing in Windows (C:\Windows\System32\wscript.exe)

You can run it from command line, create shortcut (.lnk) for it, add it as button to TC, add it in TC's Start menu, anything.
oko
Senior Member
Senior Member
Posts: 200
Joined: 2007-05-03, 16:22 UTC

Re: Secondary lng with own changes

Post by *oko »

Thanks Sob for script. I have succesfuly tried. One problem I have. Script generates line text e.g. "text\tText" in script to "text (tab) Text" in lng. How to write text to be not substituted "\t" with tab but keep "\t" as is? In lng file must stay "text\tText".

As I have experienced, js file in program files-tc-language folder is not function because of win protection. I have to copy lng file to temporary location where changes can be done and then to copy changed lng back to program files-tc-language folder.

Script helps to save time but still user will have to generate new user lng each time tc will release new version. So secondary lng would be more comfortable because no activity would be required from user.
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Secondary lng with own changes

Post by *Fla$her »

2oko
In js, the backslash needs to be doubled: text\\tText

Change the wincmd.ini keys:

Code: Select all

[Configuration]
AdminTimeout=0
AlwaysAsAdmin=1
Start TC from the shortcut with admin rights, then there will be no problems with the system folder.
Overquoting is evil! 👎
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Secondary lng with own changes

Post by *Stefan2 »

Me guess "text\tText" is part of the inFile content.
So the content of the inFile must first be altered, e.g. from "\t" to "\#t" and afterwards back.






 
User avatar
beb
Senior Member
Senior Member
Posts: 430
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: Secondary lng with own changes

Post by *beb »

petermad wrote: 2023-05-24, 12:14 UTC So support++
Had been thinking to post something similar.
So, support+++
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10
User avatar
petermad
Power Member
Power Member
Posts: 14741
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Secondary lng with own changes

Post by *petermad »

I previously wrote:
So if TC would always look first in wcmd_user.lng (as a new reserved file name) for the translation, then in wcmd_deu.lng and finally in internal English - that would be a nice feature.
I think it might be better to name the file userlng.ini to match usercmd.ini - and place the file in %COMMANDER_PATH% instead of in %COMMANDER_PATH%\Language (likewise for a userinc.ini file)

So for example for German language, entries in:
usercmd.ini overrides entries in wcmd_deu.ini (current behaviour)
userlng.ini overrides entries in wcmd_deu.lng
userinc.ini overrides entries in wcmd_deu.inc

with the previous suggested name: wcmd_user.lng - that file would be listed in TC's language setup (everything in the language folder that starts with wcmd_ ) - with the userlng.ini approach, this will not be a problem.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3278
Joined: 2003-05-06, 11:46 UTC

Re: Secondary lng with own changes

Post by *Sir_SiLvA »

petermad wrote: 2023-06-14, 13:59 UTC I think it might be better to name the file userlng.ini to match usercmd.ini - and place the file in %COMMANDER_PATH% instead of in %COMMANDER_PATH%\Language (likewise for a userinc.ini file)
No, please put them under %COMMANDER_PATH%\Language where they belong :!:
(a) %COMMANDER_PATH% has allready way to many files in it and b) its allready bad enough we cant choose where to put usercmd.ini)
Hoecker sie sind raus!
Post Reply