Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot strings language localization #19

Closed
rndquu opened this issue Aug 29, 2024 · 15 comments · Fixed by #20
Closed

Bot strings language localization #19

rndquu opened this issue Aug 29, 2024 · 15 comments · Fixed by #20

Comments

@rndquu
Copy link
Member

rndquu commented Aug 29, 2024

Original comment: ubiquity-os-marketplace/command-start-stop#25 (comment)

There may be cases when partner would need to customize the plugin's text response to some commands.

Possible use cases:

  • different text messages for different business logic flows
  • translation to other languages

It could be useful to keep a separate json file of used strings in the plugin repository. This way plugin developers would host json file in the plugin's repo while partners would be able to customize the whole "text strings" file without cluttering the config too much.

Example config with a new param customStringsUrl:

- plugin: http://localhost:4000
  name: start-stop
  id: start-stop-command
  description: "Allows a user to start/stop a task without negative XP impact"
  command: "\/start|\/stop"
  example: "/start" # or "/stop"
  with:
    reviewDelayTolerance: "3 Days"
    taskStaleTimeoutDuration: "30 Days"
    maxConcurrentTasks: 3
    startRequiresWallet: true
    ## ...
    ## ...
    ## NEWLY ADDED CONFIG PARAM
    customStringsUrl: https://raw.githubusercontent.com/dev/new-pugin/development/strings.json

So as a part of this issue we should add a basic plugin config and an example usage of the customStringsUrl param so that future plugin developers could fork this repo and use configurable text messages instead of hardcoding them in the code.

@Keyrxng
Copy link
Member

Keyrxng commented Aug 29, 2024

This is good.

We could also create a task in each core plugin to create a pool of easy to complete plugin issues as it's not a hard task to add the param and extract error and common strings, what do you think?

@rndquu
Copy link
Member Author

rndquu commented Aug 29, 2024

This is good.

We could also create a task in each core plugin to create a pool of easy to complete plugin issues as it's not a hard task to add the param and extract error and common strings, what do you think?

I would again keep it simple and add custom strings to the core plugins only when we really need them :)

This issue is more of a reminder for plugin developers that plugin users might want to customize some of the text messages.

@whck6
Copy link
Contributor

whck6 commented Aug 30, 2024

/start

Copy link
Contributor

ubiquity-os bot commented Aug 30, 2024

DeadlineFri, Aug 30, 5:15 AM UTC
Registered Wallet 0x1133830C73B2251DB9373e1B668D01E9dd2B99B1
Tips:
  • Use /wallet 0x0000...0000 if you want to update your registered payment wallet address.
  • Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
  • Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.

@gentlementlegen
Copy link
Member

gentlementlegen commented Aug 30, 2024

Wouldn't it be more handy to use a i18n package directly that can handle this way better than manually exposing all the strings of the plugin? Anyone could make a PR with just a json file containing all the translations. If this goes beyond simply translating, I think a file would be better than cluttering the whole configuration with strings.

@Keyrxng
Copy link
Member

Keyrxng commented Aug 30, 2024

Wouldn't it be more handy to use a i18n package directly that can handle this way better than manually exposing all the strings of the plugin? Anyone could make a PR with just a json file containing all the translations. If this goes beyond simply translating, I think a file would be better than cluttering the whole configuration with strings.

If we use a file then how does a partner customize the strings for their install?

I think ideally, we'd make the config item optional so that it's not a requirement to define customStrings. Then if the partner wants a non-english version they can simply add their string in whatever language they choose.

@gentlementlegen
Copy link
Member

A partner can host their file and point towards it in the configuration too. I just think it will be inconvenient to have a configuration full of strings, and it is very easy to make typos and not have the content work properly. If there are like < 5 strings it's fine I suppose, but above it will clutter quickly.

@rndquu
Copy link
Member Author

rndquu commented Aug 30, 2024

Wouldn't it be more handy to use a i18n package directly that can handle this way better than manually exposing all the strings of the plugin? Anyone could make a PR with just a json file containing all the translations. If this goes beyond simply translating, I think a file would be better than cluttering the whole configuration with strings.

i18n is not quite fit with the plugins:

  • How should a plugin developer determine the source language of a user's comment?
  • It seems to be a standard to use only English across github
  • I haven't yet met real cases where we need i18n of strings

it will clutter quickly

I guess default values should be provided in cases a string is missing in the config. So partners will have to "clutter" the config with custom strings only when they need to rewrite them.

A partner can host their file

I agree this approach is way easier (basically web2 approach) but it's not clear where to host those translation files for all plugins that partners would use.

Overall it's more of a product related question. @0x4007 Do the bot's plugins need to support different languages for output text strings (i.e. the ones that the bot replies in github comments)?

@0x4007
Copy link
Member

0x4007 commented Aug 30, 2024

I don't think supporting other languages is a priority in the near future. Besides, modern browsers all have translation built in.

@rndquu
Copy link
Member Author

rndquu commented Aug 30, 2024

@Keyrxng @gentlementlegen

What if we simply add a new config param like customStringsUrl which would point to a json file with text string contents? This way plugin developer would host json file in the plugin's repo while partners would be able to customize the whole "text strings" file without cluttering the config too much.

@Keyrxng
Copy link
Member

Keyrxng commented Aug 30, 2024

I don't think supporting other languages is a priority in the near future. Besides, modern browsers all have translation built in.

There should be a mic drop emoji

I guess default values should be provided in cases a string is missing in the config

I expected that 9/10 the defaults would have been used anyway but yeah that's what thought too, all strings would naturally have our defaults applied.

it will clutter quickly.

Agreed large plugins could end up messy if they decided they wanted to customize every string

It seems to be a standard to use only English across github

Very much agreed plus with modern browsers supporting translation maybe it's not as important here as it is on telegram for example

@rndquu
Copy link
Member Author

rndquu commented Aug 30, 2024

@whck6 Sorry for the inconvenience, pls check the updated issue description

@whck6
Copy link
Contributor

whck6 commented Aug 31, 2024

@rndquu It should be an optional parameter, am I right?

@rndquu
Copy link
Member Author

rndquu commented Aug 31, 2024

@rndquu It should be an optional parameter, am I right?

If you mean whether the customStringsUrl parameter should be optional for other plugin decelopers, then yes, but ubiquibot/plugin-template must use it and have an example of how string localization can be set up

@rndquu rndquu closed this as completed in #20 Sep 6, 2024
Copy link
Contributor

ubiquity-os bot commented Sep 6, 2024

[ 50 WXDAI ]

@whck6
Contributions Overview
View Contribution Count Reward
Issue Task 1 50
Issue Comment 1 0
Review Comment 6 0
Conversation Incentives
Comment Formatting Relevance Reward
@rndquu It should be an optional parameter, am I right?
0
content:
  p:
    symbols:
      \b\w+\b:
        count: 10
        multiplier: 0
    score: 1
multiplier: 0
0.9 -
Signed-off-by: Wenhao Ho <[email protected]> Resolves #19 …
0
content:
  p:
    symbols:
      \b\w+\b:
        count: 11
        multiplier: 0
    score: 1
  a:
    symbols:
      \b\w+\b:
        count: 4
        multiplier: 0
    score: 1
  ul:
    symbols:
      \b\w+\b:
        count: 45
        multiplier: 0
    score: 1
  li:
    symbols:
      \b\w+\b:
        count: 35
        multiplier: 0
    score: 1
multiplier: 0
0.3 -
@rndquu You're right. so? https://raw.githubusercontent.com/ubiq…
0
content:
  p:
    symbols:
      \b\w+\b:
        count: 15
        multiplier: 0.2
    score: 1
multiplier: 0
1 -
@rndquu I assume the format could be like it, what do you think?…
0
content:
  p:
    symbols:
      \b\w+\b:
        count: 13
        multiplier: 0.2
    score: 1
  pre:
    symbols:
      \b\w+\b:
        count: 4
        multiplier: 0.2
    score: 0
  code:
    symbols:
      \b\w+\b:
        count: 4
        multiplier: 0.2
    score: 1
multiplier: 0
1 -
Yes, it is.
0
content:
  p:
    symbols:
      \b\w+\b:
        count: 3
        multiplier: 0.2
    score: 1
multiplier: 0
1 -
FYI. [here](https://github.com/ubiquibot/plugin-template/issues/…
0
content:
  p:
    symbols:
      \b\w+\b:
        count: 2
        multiplier: 0.2
    score: 1
  a:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.2
    score: 1
multiplier: 0
1 -
@rndquu Do you mind helping to review?
0
content:
  p:
    symbols:
      \b\w+\b:
        count: 7
        multiplier: 0.2
    score: 1
multiplier: 0
1 -

[ 11.04 WXDAI ]

@Keyrxng
Contributions Overview
View Contribution Count Reward
Issue Comment 3 11.04
Conversation Incentives
Comment Formatting Relevance Reward
This is good. We could also create a task in each core plugin …
4.4
content:
  p:
    symbols:
      \b\w+\b:
        count: 44
        multiplier: 0.1
    score: 1
multiplier: 1
0.7 3.08
If we use a file then how does a partner customize the strings f…
5.6
content:
  p:
    symbols:
      \b\w+\b:
        count: 56
        multiplier: 0.1
    score: 1
multiplier: 1
0.9 5.04
There should be a mic drop emoji I expected that 9/10 the defau…
7.3
content:
  p:
    symbols:
      \b\w+\b:
        count: 73
        multiplier: 0.1
    score: 1
multiplier: 1
0.4 2.92

[ 94.97 WXDAI ]

@rndquu
Contributions Overview
View Contribution Count Reward
Issue Specification 1 33.6
Issue Comment 5 57.62
Review Comment 7 3.75
Conversation Incentives
Comment Formatting Relevance Reward
Original comment: https://github.com/ubiquibot/command-start-sto…
33.6
content:
  p:
    symbols:
      \b\w+\b:
        count: 43
        multiplier: 0.1
    score: 1
  a:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.1
    score: 5
  ul:
    symbols:
      \b\w+\b:
        count: 67
        multiplier: 0.1
    score: 0
  li:
    symbols:
      \b\w+\b:
        count: 59
        multiplier: 0.1
    score: 1
  code:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.1
    score: 5
  pre:
    symbols:
      \b\w+\b:
        count: 57
        multiplier: 0.1
    score: 0
multiplier: 3
1 33.6
I would again keep it simple and add custom strings to the core …
8.4
content:
  p:
    symbols:
      \b\w+\b:
        count: 42
        multiplier: 0.2
    score: 1
multiplier: 1
0.5 4.2
`i18n` is not quite fit with the plugins: - How should …
51
content:
  p:
    symbols:
      \b\w+\b:
        count: 8
        multiplier: 0.2
    score: 1
  code:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.2
    score: 1
  ul:
    symbols:
      \b\w+\b:
        count: 136
        multiplier: 0.2
    score: 1
  li:
    symbols:
      \b\w+\b:
        count: 110
        multiplier: 0.2
    score: 1
multiplier: 1
0.7 35.7
@Keyrxng @gentlementlegen What if we simply add a new config p…
11.2
content:
  p:
    symbols:
      \b\w+\b:
        count: 55
        multiplier: 0.2
    score: 1
  code:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.2
    score: 1
multiplier: 1
1 11.2
@whck6 Sorry for the inconvenience, pls check the updated issue …
2.2
content:
  p:
    symbols:
      \b\w+\b:
        count: 11
        multiplier: 0.2
    score: 1
multiplier: 1
0.2 0.44
If you mean whether the `customStringsUrl` parameter sho…
7.6
content:
  p:
    symbols:
      \b\w+\b:
        count: 35
        multiplier: 0.2
    score: 1
  code:
    symbols:
      \b\w+\b:
        count: 3
        multiplier: 0.2
    score: 1
multiplier: 1
0.8 6.08
@whck6 Overall looks good, pls add a real example of `json&#…
0.4
content:
  p:
    symbols:
      \b\w+\b:
        count: 15
        multiplier: 0.1
    score: 1
  code:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.1
    score: 1
multiplier: 0.25
1 0.4
Why don't we pass a real `json` file here from the https…
0.5
content:
  p:
    symbols:
      \b\w+\b:
        count: 19
        multiplier: 0.1
    score: 1
  code:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.1
    score: 1
multiplier: 0.25
1 0.5
Keep `configurableResponse` untouched, it should serve a…
1.25
content:
  p:
    symbols:
      \b\w+\b:
        count: 49
        multiplier: 0.1
    score: 1
  code:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.1
    score: 1
multiplier: 0.25
1 1.25
Pls create and use a real file hosted in https://github.com/ubiq…
0.375
content:
  p:
    symbols:
      \b\w+\b:
        count: 15
        multiplier: 0.1
    score: 1
multiplier: 0.25
1 0.375
Yes, the format could be (example): ```json { "…
0.425
content:
  p:
    symbols:
      \b\w+\b:
        count: 6
        multiplier: 0.1
    score: 1
  pre:
    symbols:
      \b\w+\b:
        count: 11
        multiplier: 0.1
    score: 0
  code:
    symbols:
      \b\w+\b:
        count: 11
        multiplier: 0.1
    score: 1
multiplier: 0.25
1 0.425
Is there a way to use a single/unified instance of `logger.e…
0.525
content:
  p:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.1
    score: 1
  code:
    symbols:
      \b\w+\b:
        count: 20
        multiplier: 0.1
    score: 1
  pre:
    symbols:
      \b\w+\b:
        count: 20
        multiplier: 0.1
    score: 0
multiplier: 0.25
1 0.525
I think it's fine, it's just for demo purposes
0.275
content:
  p:
    symbols:
      \b\w+\b:
        count: 11
        multiplier: 0.1
    score: 1
multiplier: 0.25
1 0.275

[ 15.28 WXDAI ]

@gentlementlegen
Contributions Overview
View Contribution Count Reward
Issue Comment 2 10.38
Review Comment 2 4.9
Conversation Incentives
Comment Formatting Relevance Reward
Wouldn't it be more handy to use a `i18n` package direct…
6.2
content:
  p:
    symbols:
      \b\w+\b:
        count: 61
        multiplier: 0.1
    score: 1
  code:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.1
    score: 1
multiplier: 1
0.9 5.58
A partner can host their file and point towards it in the config…
6
content:
  p:
    symbols:
      \b\w+\b:
        count: 60
        multiplier: 0.1
    score: 1
multiplier: 1
0.8 4.8
Maybe it would make more sense to default this to the `strin…
1.6
content:
  p:
    symbols:
      \b\w+\b:
        count: 14
        multiplier: 0.1
    score: 1
  code:
    symbols:
      \b\w+\b:
        count: 2
        multiplier: 0.1
    score: 1
multiplier: 1
1 1.6
With this logic, it seems that when `customStringsUrl` i…
3.3
content:
  p:
    symbols:
      \b\w+\b:
        count: 32
        multiplier: 0.1
    score: 1
  code:
    symbols:
      \b\w+\b:
        count: 1
        multiplier: 0.1
    score: 1
multiplier: 1
1 3.3

[ 0.44 WXDAI ]

@0x4007
Contributions Overview
View Contribution Count Reward
Issue Comment 1 0.44
Conversation Incentives
Comment Formatting Relevance Reward
I don't think supporting other languages is a priority in the ne…
2.2
content:
  p:
    symbols:
      \b\w+\b:
        count: 22
        multiplier: 0.1
    score: 1
multiplier: 1
0.2 0.44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants