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

add support for translations #22

Open
Udarthegreat opened this issue Mar 7, 2022 · 4 comments
Open

add support for translations #22

Udarthegreat opened this issue Mar 7, 2022 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed long-term

Comments

@Udarthegreat
Copy link

Udarthegreat commented Mar 7, 2022

I put an issue on the main AAA repo that goes into significantly more detail about this issue. If it is necessary (it has been made clear since original posting that it is) I can post a copy below. I am posting this here since the feature would have to be developed here first from what I can tell. This is so that there is a reference here to that issue. the main point from the main AAA post is that it would be nice to have the ability to change translations in a drop down in the AAA.

Edit: as per request I have posted a copy of the original post below in my second comment

@Amaras Amaras added enhancement New feature or request help wanted Extra attention is needed long-term labels Mar 7, 2022
@Amaras
Copy link
Member

Amaras commented Mar 7, 2022

Hi, thanks for the suggestion. If we're going to aaa-py, then this is indeeed where implementing translations will be necessary.
Just to be thorough, I suggest you copy-paste the original issue in a first post edit, to be sure what is needed is directly accessible here

@Udarthegreat
Copy link
Author

Udarthegreat commented Mar 8, 2022

(The repost from the original issue on the AAA)

Feature Request

Description

One of the highest barriers to entry for any project is an inability to understand the language of the source material or in the case of websites to have to deal with translation Brouwer plugins that can be rather hit or miss with translation. Though, out of the gate, I am aware that adding translation to chapters can be more complicated then other possible additions, in my head this is more of a nice to see some day and of no urgent importance. I am aware that approving translations to chapters would be significantly harder due to the small size of the community so a competitively small amount of languages would be approved by trusted members of the community, and even then reviewing a translation would take more time then a chapter or new implementation for an existing chapter. Though this can be partially fixed by adding a translations.md (or some other similar name) with all the languages that the community can cover and making it explicitly clear that translations out of that list of lang's are unlikely to be merged until someone with knowledge of the lang can take responsibility and becomes a trusted member of the community.

Now that that is out of the way, how might this be implemented. This I will split it into two sections how the UI may work and how the actual translations would work.

UI concept

This is not that complicated, I propose that we add another drop down with translations such as the implementation switcher that would allow one to switch between translations. Below I have attached a concept image I created for how this may look, the dimensions are not 100% accurate to the AAA this is just for conversations, if needed I could make these more accurate to how it looks on AAA (I'm really new to creating concepts such as these) (also as a note these were generated using Affinity Designer, I could, if needed drop the latest version of affinity designer file in also):

AAA translation concept

(I tried to make the image smaller by putting it in a table but when I did so it disappeared for some reason) (also I did not mention previously but I think its fairly obvious this is with the light theme, because all that would be necessary to switch to a different theme would be to change colors and that is trivial) (also the text in the drop down was based on responses to my comment below)

implementation concept

Off of the top of my head there are several ways this could be achieved, some easier then others though the easier ones would likely take up more space in the repo and be less efficient. Also as mentioned below this really does depend upon what is decided in issue 611 because depending on what is chosen there may be default ways to achieve this with the site generator chosen.

01 rewrite

The first option I can think of is completely rewrite the page in a new file in the new translation language and link them together in the main English translation or in some other JSON, YAML etc. file. This would theoretically be the simplest for potential contributors but may require the most new code for the generation of the site and is definitely the least space efficient taking up most space. (Or there can be a different URL for each translation though that would require generating allot of new URLs though it would require less extra site generation code)

02 POT file based

The second option I can think of is to utilize pot and po files to store translations were each paragraph/ individual piece of separate text is a separate msgid and thus can be translated in a msgstr. As an example of this below I have a code snippet of the first paragraph of the intro translated to Romanian since that is the only language other then English I am comfortable in

msgid "The Arcane Algorithm Archive is a collaborative effort to create a guide for all important algorithms in all languages. This goal is obviously too ambitious for a book of any size, but it is a great project to learn from and work on and will hopefully become an incredible resource for programmers in the future."
msgstr "Arcane Algorithm Archive este un efort de colaborare pentru a crea un ghid în toate limbile pentru toți algoritmii importanți. Acest obiectiv evident este prea ambițios pentru o carte de orce dimensiune, dar este un proiect  minunat din care se poate învăța și pe care se poate lucra, în speranța ca  să fie o resursa pentru programatori in viitor"

A few other notes on this method that I would like to point out. For some languages it may be necessary to change were example code and mathematical formulas are at in a page then in english which would be a non trivial matter with this method from what I can tell. It would also be best for items within a table to be separate msgid's since that would, from what I can tell make it easier on someone looking to translate a particular page. As for translated plots, when necessary, the msgid would be the uri to the original image and the msgstr would be the link to the translated image.
~

Additional context

As a side note when I new chapter is added it would not require new translation files to be added because English could be the default and thus assumed, this would be added as a separate pull request when someone wants to add a new lang or just to add the basic infrastructure without adding any translations. This is also in the first paragraph "The Arcane Algorithm Archive is a collaborative effort to create a guide for all important algorithms in all languages". Also if a better method exists for web pages such as this, please comment on this because it relatively new to localization my self and am by no means an expert of any sort. Also as a side note I don't know which lang's the font used supports, if a language that is not supported by the font is added this may lead to some issues so some consideration may need to go into that before a pull request is merged for that.

Also I'm putting this up because I have not seen any others, so if there is a consensus or and existent pull request I understand if this is closed and if so please link me to that so I can gain context. Also if there is an existent plugin or something similar that has its own conventions I would appreciate if a link would be provided since I am not aware of any as of writing this. Since as I'm posting this as leios is live I was going to add a section for honkit translations but since that may not be around for much longer I'm going to leave that out, also I'm going to edit this with images for the UI concept which I still have to do.

I also just noticed this though this is significantly more thorough so I'll post it as is.

For Algorithm Archive Developers

  • This feature can be added to the Master Overview
  • There is a timeline for when this feature can be implemented (theoretically there is)
  • The feature has been added to the Master Overview
  • The feature has been implemented (Please link the PR)

@Udarthegreat
Copy link
Author

As a note, the above repost of the main post on the AAA issue references some comments on that issue since I edited it a few times after original posting, I could edit those out if need be; should I?

@leios
Copy link
Member

leios commented Mar 10, 2022

I think it's fine not to edit those in to this issue as we can look at the original issue: algorithm-archivists/algorithm-archive#991

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed long-term
Projects
None yet
Development

No branches or pull requests

3 participants