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

[GUI] Add prefs for translators #5021

Merged
merged 1 commit into from
Sep 13, 2021

Conversation

chennes
Copy link
Member

@chennes chennes commented Sep 10, 2021

Three changes to make it easier to test new translations:

When creating the original list of locales available to FreeCAD, also scan the supported external directories and add those entries to the list of locales. The additional languages will now appear in the Language preferences drop-down.

Add a hidden preference, BaseApp/General/Preferences/AdditionalLanguageDomainEntries, that will allow translators to add an entirely new language to FreeCAD via user preferences, without requiring modification of the FreeCAD source code. The format is "Language Name 1"="code1";"Language Name 2"="code2";... For example,

<FCText Name="AdditionalLanguageDomainEntries">"Esperanto"="eo";"Polish"="pl";</FCText>

Add a hidden preference, BaseApp/General/Preferences/AdditionalTranslationsDirectory, for an additional translation directory. The specified directory takes priority over all other translation file locations.

Forums discussion: https://forum.freecadweb.org/viewtopic.php?f=8&t=61212


  • Your pull request is confined strictly to a single module
  • Discussed in forum
  • Your branch is rebased on latest master
  • All FreeCAD unit tests are confirmed to pass by running ./bin/FreeCAD --run-test 0
  • All commit messages are well-written
  • Your pull request is well written and has a good description
  • No tracker ticket

@luzpaz
Copy link
Contributor

luzpaz commented Sep 10, 2021

Neato!
CC @kaktusus

When creating the original list of locales available to FreeCAD, also
scan the external directories and add those entries to the list of
locales. This enables the installation of a language pack in an
already-installed version of FreeCAD, allowing translators to test their
work more easily.

Add a hidden preference that will allow translators to add an entirely new
language to FreeCAD via user preferences, without requiring modification
of the FreeCAD source code.

Add a hidden preference for an additional translation directory.
@luzpaz luzpaz added Mod: Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD Translation Translation and localization related labels Sep 12, 2021
@yorikvanhavre
Copy link
Member

Note: this needs to be adapted as well: https://github.com/FreeCAD/FreeCAD/blob/master/src/Tools/updatecrowdin.py#L308 ...
Maybe this?

    # checking for existing entry
    lastentry = 0
    for i,l in enumerate(cppcode):
        if l.startswith("    d->mapLanguageTopLevelDomain[QT_TR_NOOP("):
            lastentry = i
            if "\""+lncode+"\"" in l:
                print(lnname+" ("+lncode+") already exists in Translator.cpp")
                return

    # find the position to insert
    pos = lastentry + 1

@chennes
Copy link
Member Author

chennes commented Sep 13, 2021

I was envisioning that for actual shipping of translations we'd continue to use the same technique as before, and that this new preference would only be for testing purposes. So that code should still be OK, it will insert any new translations that it finds in CrowdIn into the CPP file, right?

@yorikvanhavre
Copy link
Member

Yes... Bu tit was looking for a d->activatedLanguage = "en" line that your PR moved, so now it would probably add new languages at the wrong place. But no worries, let's merge and I'll adapt the script afterwards

@yorikvanhavre yorikvanhavre merged commit 811004b into FreeCAD:master Sep 13, 2021
yorikvanhavre added a commit to yorikvanhavre/FreeCAD that referenced this pull request Sep 13, 2021
@yorikvanhavre
Copy link
Member

yorikvanhavre commented Sep 13, 2021

Done with 455412c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mod: Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD Translation Translation and localization related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants