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

[FEATURE REQUEST] - Detecting other languages #50

Open
Sparh4wk opened this issue Jan 28, 2021 · 13 comments
Open

[FEATURE REQUEST] - Detecting other languages #50

Sparh4wk opened this issue Jan 28, 2021 · 13 comments
Labels
feature New feature or request

Comments

@Sparh4wk
Copy link

Sparh4wk commented Jan 28, 2021

Hi,

is it possible to add support for detecting other language like Russian, Chinese etc when using whisper feature on pathofexile trade website?

so msges like this one:

@Трейнгар Здравствуйте, хочу купить у вас Табула раса Матерчатая безрукавка за 6 chaos в лиге Ритуал (секция "Trade"; позиция: 3 столбец, 2 ряд)

or this one:

@캐릭명좆같네 안녕하세요, 의식(보관함 탭 "거래", 위치: 왼쪽 11, 상단 1)에 6 chaos(으)로 올려놓은 타뷸라 라사(Tabula Rasa) 단순한 로브(을)를 구매하고 싶습니다

are properly detected as trade messages and pasted into game?

thanks!

btw good job on this "addon"

@Sparh4wk Sparh4wk added the feature New feature or request label Jan 28, 2021
@Morph21
Copy link
Owner

Morph21 commented Jan 28, 2021

It's possible but i don't have a template in these languages. And google translate dont work perfect with russian and korean

@Sparh4wk
Copy link
Author

well its always starting with 안녕하세요 and Здравствуйте which means Hi/Hello. so why not just detecting those?

@Morph21
Copy link
Owner

Morph21 commented Jan 28, 2021

The issue is not only about starting letters, it needs to be sliced into groups. For example when slicing english message you need something like this:

"^(.\s)?(.+): (.+ to buy your\s+?(.+?)(\s+?listed for\s+?([\d\.]+?)\s+?(.+))?\s+?in\s+?(.+?)\s+?\(stash tab "(.)"; position: left (\d+), top (\d+)\)\s*?(.*))$"

@Morph21
Copy link
Owner

Morph21 commented Jan 28, 2021

I did started some work on it few weeks ago and made this:

^(.\s)?(.+): (안녕하세요, (.+?)\s(보관함 탭 "(.)", 위치: 왼쪽 (\d+), 상단 (\d+))에\s+?([\d.])\s*(.)\s(으)로 올려놓은\s*(.)을(를) 구매하고 싶습니다\s(.*))$

but it's not working properly yet :/

It's just a lot of work with translations etc.

@queicherius
Copy link

In case it helps, here's some more language samples:

Hi, I would like to buy your The Putrid Cloister Museum Map (T11) listed for 10 chaos in Ritual (stash tab "~price 10 chaos"; position: left 5, top 6)
Hi, ich möchte 'Das faulige Kloster 'Museum'-Karte (Lvl. 11)' zum angebotenen Preis von 10 chaos in der Ritual-Liga kaufen (Truhenfach "sell"; Position: 7 von links, 12 von oben)
Здравствуйте, хочу купить у вас Тлетворная обитель Карта музея (T11) за 10 chaos в лиге Ритуал (секция "trade"; позиция: 1 столбец, 1 ряд)
안녕하세요, 의식(보관함 탭 "판매", 위치: 왼쪽 7, 상단 12)에 10 chaos(으)로 올려놓은 악취 나는 수도원(The Putrid Cloister) 박물관 지도(Museum Map)(T11)(을)를 구매하고 싶습니다

@Sparh4wk
Copy link
Author

hopefully you can do this, cause right now its like 70%+ trades are not from english ppl :( but otherwise its the best one!

@Morph21
Copy link
Owner

Morph21 commented Jan 30, 2021

@queicherius That will be extremely helpful. Thank you for your contribution

@8Times
Copy link

8Times commented Jan 31, 2021

@Morph21 Hi there! I might help you tremendously!

You can find every (not item) name in the official trade site by changing your language in the right top and go to https://de.pathofexile.com/trade/about

For korean numbers I would suggest searching up the numbers https://en.wikipedia.org/wiki/Korean_numerals

Doing everything yourself would be a pain in the ass better filter through a HTTP request and the position where which name the item has for incoming whispers!

https://www.pathofexile.com/character-window/get-stash-items?accountName=stringName&tabIndex=stringName&league=stringName

@krissrex
Copy link

krissrex commented May 4, 2021

Looking at the poe api responses can give some clues.

Here is one in korean:

{
  "id": "55bdecf0bec0c8ace913089aa23cb39d21f3a3b4d71fe101600c0a7fd44410f0",
  "listing": {
    "method": "psapi",
    "indexed": "2021-05-04T16:35:35Z",
    "stash": {
      "name": "판매",
      "x": 1,
      "y": 4
    },
    "whisper": "@해그톡식 안녕하세요, 결전(보관함 탭 \"판매\", 위치: 왼쪽 2, 상단 5)에 7 exalted(으)로 올려놓은 레벨 5 23% 각성한 치명적인 상태 이상 보조(을)를 구매하고 싶습니다",
    "account": {
      "name": "chang_2",
      "lastCharacterName": "해그톡식",
      "online": null,
      "language": "ko_KR"
    },
    "price": {
      "type": "~price",
      "amount": 7,
      "currency": "exalted"
    }
  },
  "item": {
    "verified": true,
    "w": 1,
    "h": 1,
    "icon": "https://web.poecdn.com/image/Art/2DItems/Gems/Support/SupportPlus/DeadlyAilmentsPlus.png?v=270f401a324ca772e6e2d3c4abca8c1b&w=1&h=1&scale=1",
    "support": true,
    "league": "Ultimatum",
    "id": "55bdecf0bec0c8ace913089aa23cb39d21f3a3b4d71fe101600c0a7fd44410f0",
    "name": "",
    "typeLine": "Awakened Deadly Ailments Support",
    "baseType": "Awakened Deadly Ailments Support",
    "identified": true,
    "ilvl": 0,
    "note": "~price 7 exalted",
    "corrupted": true,
    "properties": [
      {
        "name": "Support",
        "values": [],
        "displayMode": 0
      },
      {
        "name": "Level",
        "values": [
          [
            "5 (Max)",
            0
          ]
        ],
        "displayMode": 0,
        "type": 5
      },
      {
        "name": "Cost & Reservation Multiplier",
        "values": [
          [
            "130%",
            0
          ]
        ],
        "displayMode": 0
      },
      {
        "name": "Quality",
        "values": [
          [
            "+23%",
            1
          ]
        ],
        "displayMode": 0,
        "type": 6
      }
    ],
    "requirements": [
      {
        "name": "Level",
        "values": [
          [
            "80",
            0
          ]
        ],
        "displayMode": 0
      },
      {
        "name": "Dex",
        "values": [
          [
            "79",
            0
          ]
        ],
        "displayMode": 1
      },
      {
        "name": "Int",
        "values": [
          [
            "55",
            0
          ]
        ],
        "displayMode": 1
      }
    ],
    "secDescrText": "Supports any skill that hits enemies.",
    "explicitMods": [
      "Supported Skills deal 69% more Damage with Ailments",
      "Supported Skills deal 10% less Damage with Hits",
      "Supported Skills deal 11% increased Damage over Time",
      "Damaging Ailments inflicted with Supported Skills deal damage 12% faster"
    ],
    "descrText": "This is a Support Gem. It does not grant a bonus to your character, but to skills in sockets connected to it. Place into an item socket connected to a socket containing the Active Skill Gem you wish to augment. Right click to remove from a socket.",
    "frameType": 4,
    "extended": {
      "text": "SXRlbSBDbGFzczogU3VwcG9ydCBTa2lsbCBHZW1zDQpSYXJpdHk6IEdlbQ0KQXdha2VuZWQgRGVhZGx5IEFpbG1lbnRzIFN1cHBvcnQNCi0tLS0tLS0tDQpTdXBwb3J0DQpMZXZlbDogNSAoTWF4KQ0KQ29zdCAmIFJlc2VydmF0aW9uIE11bHRpcGxpZXI6IDEzMCUNClF1YWxpdHk6ICsyMyUgKGF1Z21lbnRlZCkNCi0tLS0tLS0tDQpSZXF1aXJlbWVudHM6DQpMZXZlbDogODANCkRleDogNzkNCkludDogNTUNCi0tLS0tLS0tDQpTdXBwb3J0cyBhbnkgc2tpbGwgdGhhdCBoaXRzIGVuZW1pZXMuDQotLS0tLS0tLQ0KU3VwcG9ydGVkIFNraWxscyBkZWFsIDY5JSBtb3JlIERhbWFnZSB3aXRoIEFpbG1lbnRzDQpTdXBwb3J0ZWQgU2tpbGxzIGRlYWwgMTAlIGxlc3MgRGFtYWdlIHdpdGggSGl0cw0KU3VwcG9ydGVkIFNraWxscyBkZWFsIDExJSBpbmNyZWFzZWQgRGFtYWdlIG92ZXIgVGltZQ0KRGFtYWdpbmcgQWlsbWVudHMgaW5mbGljdGVkIHdpdGggU3VwcG9ydGVkIFNraWxscyBkZWFsIGRhbWFnZSAxMiUgZmFzdGVyDQotLS0tLS0tLQ0KVGhpcyBpcyBhIFN1cHBvcnQgR2VtLiBJdCBkb2VzIG5vdCBncmFudCBhIGJvbnVzIHRvIHlvdXIgY2hhcmFjdGVyLCBidXQgdG8gc2tpbGxzIGluIHNvY2tldHMgY29ubmVjdGVkIHRvIGl0LiBQbGFjZSBpbnRvIGFuIGl0ZW0gc29ja2V0IGNvbm5lY3RlZCB0byBhIHNvY2tldCBjb250YWluaW5nIHRoZSBBY3RpdmUgU2tpbGwgR2VtIHlvdSB3aXNoIHRvIGF1Z21lbnQuIFJpZ2h0IGNsaWNrIHRvIHJlbW92ZSBmcm9tIGEgc29ja2V0Lg0KLS0tLS0tLS0NCkNvcnJ1cHRlZA0KLS0tLS0tLS0NCk5vdGU6IH5wcmljZSA3IGV4YWx0ZWQNCg=="
    }
  }
}

You can see the whisper: @해그톡식 안녕하세요, 결전(보관함 탭 \"판매\", 위치: 왼쪽 2, 상단 5)에 7 exalted(으)로 올려놓은 레벨 5 23% 각성한 치명적인 상태 이상 보조(을)를 구매하고 싶습니다

and the json lets you find the stash tab name, which is 판매,
the stash x: 1 (shown as 2),
the stash y: 4 (shown as 5),
the price of 7 exalted,
the username 해그톡식.

What is missing is to find and translate the item names.
At least 5 23% is part of it.
As an initial solution, one can display the foreign (Korean) item names, as long as the price and username is correct.
If that is hard, maybe just display "unknown" or something like that.

@krissrex
Copy link

krissrex commented May 6, 2021

I created a junit test for different languages. It can be improved with more samples and languages.
krissrex@6e9bb41
It tests the TradeOutMessagesInterceptor.

krissrex added a commit to krissrex/MercuryTrade-Community-Fork that referenced this issue May 6, 2021
…ller parsers

The MessageParser was getting big, and looked like it could use the "strategy pattern".
So it is now split into one parser per language and trade site.
They can each be individually tested, which is a plus.

Relates to Morph21#50
krissrex added a commit to krissrex/MercuryTrade-Community-Fork that referenced this issue May 6, 2021
@krissrex
Copy link

krissrex commented May 6, 2021

I did some work on the regex parsing. It should work for Russian and Korean. I need some more trade samples for Thai, but I rarely see Thai trades now anyways.

The item names are not translated yet. This means the notifications would show e.g. Korean names for items.
But the player name and price is correct, so it should help enough for outgoing trades.

@krissrex
Copy link

krissrex commented May 6, 2021

It's possible but i don't have a template in these languages. And google translate dont work perfect with russian and korean

I got multiple different trades for the same language, and compared them to see what differed.
It took some time, but it worked.

To find the league names, I used the flag-icon in the top right to visit different pathofexile.com trade sites, and copied the text from the league selection dropdown.

@krissrex
Copy link

krissrex commented May 7, 2021

Here are two Russian currency trades:

  • @Я_ЕБАЛ_УЛЬТИМАТУМ Здравствуйте, хочу купить у вас 1 Масло индиго за 1 Сфера хаоса в лиге Ultimatum. 1 indigo oil for 1 chaos.
  • @xNewExpx Здравствуйте, хочу купить у вас 1 Фиолетовое масло за 2 Сфера хаоса в лиге Ultimatum. 1 violet oil for 2 chaos.

German item trades:

  • @Shiekaa Hi, ich möchte 'Stufe 1 18% Klingenwirbel' zum angebotenen Preis von 1 chaos in der Ultimatum-Liga kaufen (Truhenfach "~price 1 chaos"; Position: 2 von links, 8 von oben)
  • @Psychofotze Hi, ich möchte 'Chimären-Ruf Verstärkter Zauberstab' zum angebotenen Preis von 4 chaos in der Expedition-Liga kaufen (Truhenfach "Restmüll"; Position: 1 von links, 9 von oben)

A Thai item trade:

  • @Darkplayer_Ultimatum_ll สวัสดี เราต้องการชื้อ Brimstone Nails Slink Gloves ของคุณซึ่งตั้งขายไว้ในราคา 50 chaos ในลีก Ultimatum (คลังชื่อ "ขายของ2"; ตำแหน่ง: ซ้าย 1, บน 7)

A spanish item trade:

  • @VULPERRA Hola, quisiera comprar tu Nudillo de Pandemonio Guantes de nexo listado por 60 chaos en Ultimatum (pestaña de alijo "subasta"; posición: izquierda7, arriba 1)

A french skill gem trade:

  • @Askip_Le_Build_Est_Fort Bonjour, je souhaiterais t'acheter Gemme de soutien éveillée : Dégâts élémentaires des Attaques de niveau 5 à 20% de qualité pour 5 exalted dans la ligue Scourge (onglet de réserve "~price 1 chaos" ; 5e en partant de la gauche, 4e en partant du haut) (5 ex for Awakened Elemental Damage with Attacks Support)

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

No branches or pull requests

5 participants