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

Support loading articles from other languages #9

Closed
waldyrious opened this issue Dec 13, 2012 · 8 comments
Closed

Support loading articles from other languages #9

waldyrious opened this issue Dec 13, 2012 · 8 comments

Comments

@waldyrious
Copy link
Owner

waldyrious commented Dec 13, 2012

If not the interface itself, at least the content. edit: as discussed below, this issue will tackle only content multi-language support, and others will be opened to address the interface translation.

apiUrl and article.url need to be configurable.

@Jan-Ka
Copy link
Collaborator

Jan-Ka commented Oct 28, 2017

Shouldn't be too hard to implement, just a simple data structure to hold all of that T9N data:

var availableLanguages = {};

availableLanguages["en-GB"] = {
  subdomain: "en"
  ui: {
    searchButton: "Search"
  }
};

availableLanguages["de-DE"] = {
  subdomain: "de"
  ui: {
    searchButton: "Suche"
  }
};

var userLang = navigator.language; // get's something like en-GB, en, de etc.
magicUITranslatingFunction(userLang);

But we should maybe establish some packaging beforehand including minifying so we can separate the translation stuff away from the search and UI? I think I can whip something up in an hour or two.

@waldyrious
Copy link
Owner Author

I would actually love to fetch the translations directly from https://translatewiki.net (where MediaWiki itself is translated), rather than duplicating the data in this repo. Since TranslateWiki's platform is based on MediaWiki, the it should be possible to make API calls to fetch the relevant translations.

This would require an Internet connection, but the entire Primerpedia doesn't work unless it's able to make requests anyway, so I don't feel it's a prohibitive choice -- especially since English would remain as a fallback should the requests fail.

What do you think?

@Jan-Ka
Copy link
Collaborator

Jan-Ka commented Oct 29, 2017

I think I don't understand this completely because I do not know how translatewiki.net works.

As far as I understand we could make a Page there and use it to translate Primerpedia, and then extract said Translations via an API. I would probably look through https://github.com/wikimedia/mediawiki-extensions-Translate to extract it, because I couldn't find a proper documentation skimming through the project.

I don't really like the extra request but I see the appeal of it. We could do the same as mediaWiki and get a snapshot for releases (if/when we start doing that). That would have the benefit of letting the user decide what translations to offer (by simply removing the files). BUT - since we don't have direct access to files we would need some Installation Process anyway so we can ignore that right now :)

Anyway, till then I would say that we cache our translations on the client (localstorage) and track some arbritrary TTL. We talk about 3 or 4 strings maybe?

@Jan-Ka Jan-Ka mentioned this issue Oct 29, 2017
@waldyrious
Copy link
Owner Author

waldyrious commented Oct 30, 2017

I think it might be better to separate the "multiple languages for the content" feature from the "multiple languages for the Primerpedia interface itself" feature. For the former, it should suffice to present a UI control to select / input a language name or code (controllable via a URL parameter, like the search field). For the latter, setting up translation on translatewiki would be the ideal approach, yes, rather than rolling out our own translation system in this repo.

That said, if we do save a config file in this repo for the few strings that would need to be translated, I suspect we'd have a much quicker path to getting a functional multi-language site off the ground, and the translatewiki setup could be done later without wasting work since the existing translations could be imported.

So my proposal for this would be to first do the content language selection, then the interface translation using a local setup, and only later on look into translatewiki integration. If that sounds good to you, I'd open separate issues for each of these steps, to provide more granularity in the tracking.

@Jan-Ka
Copy link
Collaborator

Jan-Ka commented Oct 31, 2017

Yes, this sounds perfect.

Please create the dedicated issues :)

@waldyrious waldyrious changed the title support more languages Support loading articles from other languages Nov 1, 2017
@waldyrious
Copy link
Owner Author

Done: #46 and #47.

@waldyrious
Copy link
Owner Author

Fixed in #60.

This task was completed during the Wikimedia Hackathon 2019. The associated Phabricator task is T223849.

@waldyrious
Copy link
Owner Author

Huh. For some reason I forgot to actually close the issue.

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

No branches or pull requests

2 participants