Jump to content
Stano

Better Translator Manager - Custom component

Recommended Posts

1 hour ago, Stano said:

Please and what about the help?

What help is that?

 

55 minutes ago, Stano said:

Save.

Yes, I see it.

Apparently, the feature branch wasn't merged correctly. I'll get that fixed.

Share this post


Link to post
1 minute ago, Anders Melander said:

What help is that?

Some instructions for use.

Share this post


Link to post
Just now, Stano said:

Some instructions for use.

Ah, that... Um... Eh...

I don't really have anything besides what's on the Bitbucket page. Well, actually, now that I think of it I think I have something in a corporate Confluence page somewhere, but I will have to revise it for public consumption and it's probably targeted for use with a specific commercial project. I'll look into it later tonight.

Share this post


Link to post

I have attached an extraction of the BTM documentation I have.
As I said it was written for use with a specific project (called FooBar in this version) and as such contains references to the setup of that project (folders, config files, etc.) and it assumed that the initial translation project file and update have already been done.

The source document, as mentioned, comes from Confluence so the formatting of the exported document is a bit wacky, but I think it should be readable.

 

Using_Better_Translation_Manager_-_Anders.Melander_-_Confluence_(2023-08-16_22_10_10).html

Share this post


Link to post

Perhaps the last post:classic_wink:
I'm sure it will help. What I don't need, I ignore.
I would like to know the answer to these questions. If they are not answered in the document in question.

 

I have my own component. How should I proceed:

  • 1 Translate the component itself and get this translation into the program translation
  • 2 Always translate it in the program
  • 3 Of course, I only want to translate it once

Translation into other languages. I'm starting from programs that contain language files.
Some user gets an English version of some file. He translates it into his language

  • 4 What do I send him and
  • 5 how do I get it into the program

When you posted the first version, there was some description. The only thing I remember is that it automatically loads the language according to the OS. If no such language exists in the translation it will run the base language (source)

  • 6 But users sometimes want to use a different language than they have the OS language
  • 7 Is there such an option?

I have created a component editor. It writes to *dfm.

  • 8 Can *dfm be translated or do I have to, is it better to use another way?

A) Some components have the same property. For example Caption.

  • 9 Do I need to translate all the same occurrences? That's pretty much a no-brainer
  • 10 Screw translating them and hard use resourcestring

Such a trivial question at first glance. But I have no experience with this:

  • 11 How (methodology) and where is the best way to assign each resourcestring to each component?
  • 12 Will this work in FormCreate?

A big thank you.

Share this post


Link to post
5 hours ago, Stano said:

image.thumb.png.e7636c49a8d6c78812c865a6409bc0ce.png

Strange. The URL seems correct so it's probably just a temporary hiccup with the redirection.

 

4 hours ago, Stano said:
  • 1 Translate the component itself and get this translation into the program translation 
  • 2 Always translate it in the program
  • 3 Of course, I only want to translate it once

2: You translate the application using the component. If you use the component in multiple projects then you will have to do the translation for each project. That's unfortunately just the way Delphi localization is designed.

You can save the translations to the Translation Memory and share that between projects, but it's an almost completely manual process.

 

4 hours ago, Stano said:

Translation into other languages. I'm starting from programs that contain language files.
Some user gets an English version of some file. He translates it into his language

  • 4 What do I send him and
  • 5 how do I get it into the program

All the translations are contained in the translation project file (the xlat file).

A translator will need amTranslationManager.exe and the .xlat file. I would recommend that you also create a portable-mode configuration file so the translator doesn't need to install anything. I think the docs mention that.

 

Once you receive an updated xlat file from the translator you will have to merge that into your local xlat file using some sort of text merge tool. I suggest placing the file under version control and then use that to do the merge.

There is no functionality in BTM to merge two translation project files, although that would be a handy feature.

 

4 hours ago, Stano said:

When you posted the first version, there was some description. The only thing I remember is that it automatically loads the language according to the OS. If no such language exists in the translation it will run the base language (source)

  • 6 But users sometimes want to use a different language than they have the OS language
  • 7 Is there such an option?

It's still there: https://bitbucket.org/anders_melander/better-translation-manager/src/master/#markdown-header-deploying-a-localized-application

 

The hello_world demo contains an example of how to allow the user to choose the language.

As far as I remember there are some other methods buried in the announcement thread:

 

4 hours ago, Stano said:

I have created a component editor. It writes to *dfm.

  • 8 Can *dfm be translated or do I have to, is it better to use another way?

If your text is written as a string (or stringlist) property, then it can be translated.

 

4 hours ago, Stano said:

A) Some components have the same property. For example Caption.

  • 9 Do I need to translate all the same occurrences? That's pretty much a no-brainer
  • 10 Screw translating them and hard use resourcestring

Yes. Individual properties on individual components are individually translated.

BTM will help you with the translation of identical texts, but it will not do it automatically since that might not be what you want. Often context matters.

For example, if you translate "Cancel"->"Fortryd" then it will prompt you to translate all other occurrences of "Cancel" using the same translation. It will even offer to translate texts that "almost" match such as "cancel", "&Cancel", "Cancel!", etc.

 

4 hours ago, Stano said:

Such a trivial question at first glance. But I have no experience with this:

  • 11 How (methodology) and where is the best way to assign each resourcestring to each component?
  • 12 Will this work in FormCreate?

Use resourcestrings just like you would use a string constant. The only thing to be aware of is that the resourcestring name needs to be unique within the unit.

Resourcestrings are a language feature and as such it is processed by the compiler and the linker (with help from the RTL at runtime). FormCreate is a run-time thing so that doesn't matter; Use them where ever you want.

 

Some prefer to keep all resourcestrings in a separate unit, some prefer to have them at the top of the unit and some to have them declared locally where they are used.

 

I usually declare them with the most restrictive scope I can get away with:

unit Foo;

implementation

procedure DoFoo;

resourcestring
  sFooPublic = 'This is a public, global resourcestring'; // Usable by all that use unit Foo

interface

resourcestring
  sFooPrivate = 'This is a private, global resourcestring'; // Usable within unit Foo

procedure DoFoo;
resourcestring
  sFoo = 'This is a local resourcestring'; // Usable within DoFoo
begin
  ShowMessage(sFoo);
end;

end.

Note though that FreePascal doesn't support local resourcestrings. In FPC they must be declared globally (i.e. outside the methods/functions).

Edited by Anders Melander

Share this post


Link to post

Thank you very much. I think I have enough information.
Unfortunately, all the links to your page show me a blank "screen".

I hope that all the information will be used by other BTM users.

Share this post


Link to post
5 minutes ago, Stano said:

Unfortunately, all the links to your page show me a blank "screen".

Then it's probably a problem with your browser. [Ctrl]+F5 to do a forced reload or use another browser.

Share this post


Link to post

That was the first thing I did. Nothing.

I don't deal with it anymore.

Share this post


Link to post
On 8/17/2023 at 2:35 PM, Stano said:

Unfortunately, all the links to your page show me a blank "screen".

If you mean bitbucket site then it's unusable with somewhat older browsers. You need a newer one to see something

Share this post


Link to post

It's okay now.
I use Brave and in critical cases Edge. The problem has been with both. Both are "new".

Share this post


Link to post
1 hour ago, Fr0sT.Brutal said:

If you mean bitbucket site then it's unusable with somewhat older browsers.

I can confirm that it doesn't work in NCSA Mosaic 2.0

image.thumb.png.10d7e1b15ff4bb7e924d9e01140c0354.png

 

I also tried Netscape Navigator 3.0

image.thumb.png.45ea143d0bb032a44537818af8c59584.png

 

 

Share this post


Link to post
1 minute ago, Anders Melander said:

I can confirm that it doesn't work in NCSA Mosaic 2.0

Perfect! Now you could return your DeLorean somewhat later and try Firefox 56 which I still use and observe the blank page

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×