Android Question Localizator Further format options

Sgdva

Member
Licensed User
Background:
I need an easy way to translate the strings in my app Localizator works nicely, however, I need to use italics, bold and hyperlinks on the text used. I have tried as it was used on html, but it is not working.
Problem:
I have not found a way to make that the localizator recognizes this formats on specific words
Code:
I am not sure if it is worth on how I call the strings, but it is like this:
B4X:
Starter.ObjLocalizator.Localize("txt_formatted")
In excel looks like the html:
<a href="http://www.freepik.com">8Ms,5s and 7Ps Icons: Designed by macrovector / Freepik</a>
However it's set as such, no hyperlinks.

Further thoughts
I tried to set italics and bold in excel, in hopes that may help, but no luck.
 

Attachments

  • Sample.zip
    191.5 KB · Views: 233
  • Untitled.png
    Untitled.png
    40.8 KB · Views: 290
Last edited:

Myr0n

Active Member
Licensed User
Longtime User
Can you post a small project of your prototype please.

Just, exactly what you are trying.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

Sgdva

Member
Licensed User
Why is your app using Android 2 theme (based on the screenshot)?

Localizator returns a string based on the key string. That's it.
You can add any format you like to these strings. You will then need to parse it in your app and use CSBuilder to format the styled strings.

This code can be useful for this task: https://www.b4x.com/android/forum/threads/csbuilder-marking-based-on-regex-pattern.83002/#content

@Erel Thank you so much for this information, unfortunately, I have not been able to make it work.
The Screenshot was a sample on what I am looking for (as I could not find it in one app as now), it is not the real app; they were two apps that I found had what I am chasing to do.
Approach
I attempted to recreate your example in the link given -where it should log when I click the text-, however, nothing is parsed at the "Logs". The color is changed correctly.
Additionally, I tried to use the string builder as stated in this post for hyperlinks, but no luck either.
I checked all sample projects to see if one may help, but the only one that I found with hypertext link uses a label and the full link. I would not like something like this:
Google: www.google.com
Instead I am just looking to create Google
Additionally to your helpful CSBuilder, I attempted to create a stringbuilder function for hyperlinks, but I think I am not doing the right logic there.
I attach this new version with these changes
Further thoughts
Could it be due to the fact that I am using the CustomListView? Should I use something else?
How could I make Italic/bold the color defined on the CS?
 

Attachments

  • Sample2.zip
    182 KB · Views: 224
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I attempted to recreate your example in the link given -where it should log when I click the text-, however, nothing is parsed at the "Logs". The color is changed correctly.
Additionally, I tried to use the string builder as stated in this post for hyperlinks, but no luck either.
You should use CSBuilder. Nothing else.

Could it be due to the fact that I am using the CustomListView?
No.

ow could I make Italic/bold the color defined on the CS?
You need to do some work here. Define a simple markup "language" and build a parser that converts the marked string to a CharSequence using CSBuilder.
 
Upvote 0

Sgdva

Member
Licensed User
You should use CSBuilder. Nothing else.


No.


You need to do some work here. Define a simple markup "language" and build a parser that converts the marked string to a CharSequence using CSBuilder.
Thank you for your support, although I was not able to do it in a custom listview since the parameter to listen to is the label.
Nevertheless, the label can be scrolled (which was my real concern) so it works.
I have to say that this library is also useful
 
Upvote 0
Top