EclipseTech / FishingBuddy

Guild Wars 2 BlishHUD module
8 stars 6 forks source link

Language option #23

Open Bagu opened 2 years ago

Bagu commented 2 years ago

Is your feature request related to a problem? Please describe. Fishing Buddy is in english but my game is in an other language

Describe the solution you'd like Ability to display info in the game's language

Quachero commented 2 years ago

@EclipseTech, Hi !

If you need some help with french translation and you have a translation file, I can help. I really love FishingBuddy and trying to convince some friends to use it, but they wont because it's in english and isn't convenient for know wich bait to use, ...

I'm pretty sure some people want to help with other languages

EclipseTech commented 2 years ago

Hey thanks for letting me know. I'll work on an update.

Is it just the bait? Or does that include other parts as well? Fishing holes? Time of day?

I could use help on some translations, although not exactly sure best way to go about it yet.

If anyone could provide translation for https://github.com/EclipseTech/FishingBuddy/blob/master/ref/fish.json and for this selection https://github.com/EclipseTech/FishingBuddy/blob/master/FishingBuddyModule.cs#L112-L165 that would be a great start. I'll look into language localization.

Quachero commented 2 years ago

I think it will be good to translate at least fish name, bait, fishing holes and achievement (generally people understand time of day and rarity easly, but I think it won't be a big effort to do it too if everything else is done).

I will start by fish.json. You prefer to have a fish_fr.json or some new key on json like Name_fr, FishingHole_fr, ... ?

EclipseTech commented 2 years ago

Fish names and achievement should already be translated using api, and I can add bait to that, but don't have a way yet to do fishing hole.

Can you confirm that fish names and achievements are translated currently?

Bagu commented 2 years ago

Nope, not everywhere. https://zupimages.net/up/22/19/xefa.png

Quachero commented 2 years ago

I look a little the code, I think you get fish by the json and not the API.

You set a fish list like this :

using (StreamReader r = new StreamReader(this.ContentsManager.GetFileStream(@"fish.json"))) { string json = r.ReadToEnd(); this._allFishList.AddRange(JsonConvert.DeserializeObject<List<Fish>>(json)); Logger.Debug("Fish list: " + string.Join(", ", this._allFishList.Select(fish => fish.Name))); } this._useAPIToken = true;

After you get fish that match with api fish get by item id in that list :

Item fish = await this.RequestItem(itemId); Logger.Debug($"Found Fish '{fish.Name}' id: '{fish.Id}'"); // Get first fish in all fish list that matches name var fishIdMatch = this._allFishList.Where(phish => phish.ItemId == fish.Id); Fish ghoti = fishIdMatch.Count() != 0 ? fishIdMatch.First() : null;

You put that fish in another list :

if (ghoti.Locations is null || ghoti.Locations.Contains(_currentMap.Id)) { this.catchableFish.Add(ghoti); } else { Logger.Debug($"Skipping {fish.Name} {fish.Id}, not available in current map."); } bitsCounter++;

You sort this list in another list and for each element of this list, you display tooltip :

var catchable = this.catchableFish.OrderByDescending(f => f.Visible). ThenBy(f => f.Caught && f.Visible). ThenBy(f => f.Rarity). ThenBy(f => f.Name); foreach (Fish fish in catchable) { string fishTooltip = this.BuildTooltip(fish);

So, if I understand (my C# is rusty), isn't translated API item who is used for tooltip in finaly but the json item who isn't translated.

EclipseTech commented 2 years ago

I actually found the spot where the achievement and fish name weren't being added correctly.

Bait and fishing hole and a few others are still needing translation. Working on that.

EclipseTech commented 2 years ago

(╯°□°)╯︵ ┻━┻

(-‸ლ) New update will be out soon. You can look at https://github.com/EclipseTech/FishingBuddy/blob/master/Properties/Strings.resx to add new localization translations.

Adding Strings.fr.resx of the same should translate to french.

This is my first attempt at localization, so hopefully that's all that's needed.

Quachero commented 2 years ago

I will translate this during the week and I will give you the file ;-). Thanks a lot for your work !

(If I see some missing key, I will prevent you, I write all key I found in a file, so I will compare with your changes)

Quachero commented 2 years ago

Hi !

I give you a first version of your file with french translation. I save it as txt because github don't allow me to upload it as resx or xml ...

During translation, I found some useless keys and some missing keys for translate all, I will share you that during the week-end, but I think we can do one try with this first version ;-).

Strings_fr.txt

Quachero commented 2 years ago

Hi !

I see you make a new version with translation. Thanks a lot ! Few feedbacks for improvements :

There is some problems :

  • Only one fish is displayed now (only in french translation, trying with other lang and it's good), maybe because there is simple quotes on french translation and I don't escape it with backslash and maybe it provides a bug.

fish_buddy_one_fish_display

  • Some texts in option are too longs. I do another translation with shorter text, si will be good with it, but other language like german can include very long text. So isn't a problem for the moment, but I think you will change options display one day ^^'.

fish_buddy_text_too_long

There are some missing keys :

Rarity (not really important in my opinion but I inform you if you want a full translatable module):

  • Junk
  • Basic
  • Fine
  • Masterwork
  • Rare
  • Exotic
  • Ascended
  • Legendary

Notes (not really important in my opinion but I inform you if you want a full translatable module):

  • Specialization Collection: Crushing Weight
  • Specialization Collection: Purifier
  • Specialization Collection: The Keenest Cut
  • Specialization Collection: Quietus
  • Specialization Collection: Possession
  • Specialization Collection: Dichotomy
  • Specialization Collection: Prima Donna
  • Specialization Collection: Gravity
  • Specialization Collection: Percussive Maintenance:
  • Release for 2500 karma
  • Release for 1500 karma
  • Release for 350 karma
  • Used as bait
  • Used for Daijun Bay renown heart (I think will never appear, not a fish for a collection)
  • Used for Shinota Shore renown hear (I think will never appear, not a fish for a collection)
Quachero commented 2 years ago

Also, I think some keys are useless :

  • Fish Panel Location (don't find where it appear)
  • Time of Day Details Location (don't find where it appear)
  • Time of Day Details Location (don't find where it appear)
  • Time Label Position (find it before v1.0.11 but not on current version I think)
  • Clock display label alignment (find it before v1.0.11 but not on current version I think)
  • Deep Fishing Hole (it's an unique fish hole in Arborestone, so never appear on fish bubble)
  • Polluted Lake Fish (isn't on fish.json, never find it, someone say me is an old fish hole and merge with Noxious Water Fish)
  • Rare Fish (hole for fish competition, so never appear on fish bubble)
  • Wreckage Site (never find it, not appear on fish.json)
  • Special Fishing Hole (never find it, not appear on fish.json)
  • Mysterious Waters Fish (not appear in fish.json, hole in black lion area, so will never appear on fish bubble)
  • Lutgardis Trout (it's for a quest in Mori village, not appear on fish.json, so will never appear on fish bubble)
Quachero commented 2 years ago

A version with shorter text for option and backslash on quote:

string_fr_v2.txt

EclipseTech commented 2 years ago

@Quachero Can you make a Pull Request to the repo changing the Properties/Strings.fr.resx file for translation?

I made some changes that should now localize everything you brought up.

Strings.fr.resx will need to be update and added to with what is missing from Strings.resx

Quachero commented 2 years ago

Hi

Sorry for take a long time, I was bussy all the week ^^'

I make a pull request for improvements : https://github.com/EclipseTech/FishingBuddy/pull/24

Edit : Don't know why, but git really want to delete this borde_X ...