Comments (13)
This regex isn't being run every time there's an API call; it's being run when item prices are updated and data is uploaded to the cloudflare KVs for the API to use:
https://github.com/the-hideout/tarkov-data-manager/blob/9e5472004784624c75e3ee0b3a83ec1598586623/src/tarkov-data-manager/jobs/update-item-cache.js#L471-L477
from tarkov-api.
To add: the FleaMarket name is all CAPS, I think it must be like others with only the first letter capital
from tarkov-api.
I'm not sure if there is a historical reason for why we have normalizedName: String
excluded from the FleaMarket
item. If there isn't a good reason for why this is missing today, then I agree and we should absolutely add it! :)
As for the type
name, I think it is correct being FleaMarket
. Looking at the schema, many other types have this same case definition. See the examples below:
from tarkov-api.
Apologise for wording it wrongly, it's all caps what is returned in the name
field by the API, I see "name": "БАРАХОЛКА",
from tarkov-api.
p.s. Question: if the flea market is disabled do we still get the flea market in sellto
/buyfrom
but with enabled: false
?
from tarkov-api.
We can add normalizedName to the FleaMarket type. It's missing because normalizedName was a recent addition to the traders and it just wasn't added to the FleaMarket type at the time.
The flea market name being all in caps is due to the lowercase regex not properly picking up Cyrillic uppercase characters. Is барахолка
a more appropriate capitalization?
from tarkov-api.
The flea market name being all in caps is due to the lowercase regex not properly picking up Cyrillic uppercase characters. Is
барахолка
a more appropriate capitalization?
yes, but with the first letter capital like for all other traders, Барахолка
from tarkov-api.
This is the updated code that's being used to convert the uppercase "FLEA MARKET" to "Flea Market" for all languages:
UPPERCASE_STRING.replace(/(?<!\b)([A-ZА-Я])/g, substr => {
return substr.toLowerCase();
});
What it's supposed to do is capture any upper case letters that aren't at the beginning of a word and convert them to lower case. I added А-Я
to capture Cyrillic upper case characters, but it seems to also be capturing the first upper case letter that's at the beginning of the Russian word.
from tarkov-api.
I think I figured it out to just return the match if it's at index 1: Барахолка
Apparently issue stems from unicode characters, and the pattern to get a correct match is (?<!^|\s)([A-ZА-Я])
from tarkov-api.
As we load these names for a particular lang
can't we simply update the translation to the correct case? (just want to understand how it works, we have Therapist
and Терапевт
in the correct case, why not the Flea?)
from tarkov-api.
I was just testing other languages for Flea Market
translations and in cz
it's returned as BleŠÍ Trh but google returns Bleší Trh (in the first word the last two letters are not capital) and in fr
MarchÉ, so I suppose the regex is not working for any language other than one that use only basic Latin chars
from tarkov-api.
As we load these names for a particular
lang
can't we simply update the translation to the correct case? (just want to understand how it works, we haveTherapist
andТерапевт
in the correct case, why not the Flea?)
That's exactly what we're doing. In the localization files we have, the only string for "Flea Market" we have is in all upper case characters, so it has to be converted. Digging a bit more, I believe the proper regex to match all uppercase unicode characters that aren't at the start of a word is /(?<!^|\s)\p{Lu}+/gu
.
from tarkov-api.
This regex seems to work perfectly. 👍
But why we can't update the localization files directly and save regex
s CPU cycles?
from tarkov-api.
Related Issues (20)
- Cannot retrieve ammo.initialSpeed on pre-wipe explosive ammo. HOT 1
- HandbookCategories returns duplicate children. HOT 1
- Many objectives missing maps HOT 2
- Add failed quests property to Tasks HOT 1
- Add GPS data for TD maps to API HOT 2
- Inconsistent return type on empty Barter.requiredItems.attributes & Barter.rewardItems.attributes. HOT 1
- Currency used for x item HOT 2
- Feature Request
- '5.45x39mm PPBS gs "Igolnik"' Ammo Issue HOT 1
- Server Status Region HOT 1
- Error retrieving trader barters. HOT 1
- Inconsistent Server Status HOT 3
- Inconsistent naming convention in ItemCategories Key Mechanical data HOT 5
- Issue with query results: Incorrect kappaRequired value for "Capturing Outposts" task HOT 1
- Incorrect data being returned in taskRequirements HOT 2
- Feature request: Current game patch endpoint HOT 2
- Add New Armor System Info
- Add ability to pull player stats HOT 4
- Unable to retrieve task objective/item count HOT 1
- lang: zh make no effect. HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tarkov-api.