39 Commits

Author SHA1 Message Date
Bastien Montagne
a367cf664e Fix (unreported) I18N extraction tooling fully broken by some new strings in code.
Strings built by concatenating literals and pre-processor-defined
strings would lock the code extracting them for i18n forever.

This commit 'fixes' the issue by adding some support for these cases in
the `inbetween` regex snippet part of the 'extract string' complex regex
system, to avoid the lock.

The code has no way currently to extract the value of these defines
though, so they should not be used in translated strings.

NOTE: PR !122283 should do a propoer fix to these issues, by refactoring
the string building such that only actual strings pieces get processed
by the translation code.
2024-05-27 14:48:09 +02:00
Bastien Montagne
afb5cb440b Fix/tweak UI messages (typos etc.). 2024-03-04 11:17:55 +01:00
Bastien Montagne
9b5f01d00e I18N/UI Messages fixes. 2024-02-12 12:01:02 +01:00
Bastien Montagne
fd0d84095d I18N: Fix missing Danish language.
We had inherited Danish translation file in the repository from over a
decade ago, but it was never since then an active translation, and
therefore was never added back to the current list of known languages.

Since the file exists now and is exposed in Weblate
(translate.blender.org), language entry should be created in our
settings, such that e.g. PO files do get updated with all the others!
2024-02-05 16:47:08 +01:00
Damien Picard
3bd41cf9bc I18n: Go over TIP_ and IFACE_ usages, change to RPT_ when relevant
The previous commit introduced a new `RPT_()` macro to translate
strings which are not tooltips or regular interface elements, but
longer reports or statuses.

This commit uses the new macro to translate many strings all over the
UI.

Most of it is a simple replace from `TIP_()` or `IFACE_()` to
`RPT_()`, but there are some additional changes:
- A few translations inside `BKE_report()` are removed altogether
  because they are already handled by the translation system.
- Messages inside `UI_but_disable()` are no longer translated
  manually, but they are handled by a new regex in the translation
  system.

Pull Request: https://projects.blender.org/blender/blender/pulls/116804

Pull Request: https://projects.blender.org/blender/blender/pulls/116804
2024-01-12 13:37:32 +01:00
Damien Picard
5db82be74f Fix #76101: I18n: add new preference to translate reports
Translation of the UI is currently split into 3 preferences:
interface, tooltips, and new data. The distinction between interface
and tooltips is currently unclear as tooltips also include a lot of
messages not displayed in the actual tooltips on mouse hover.

These include reports to the Info Editor, information in editor
headers and footers, and statuses in panels.

In order to limit the use of `TIP_()` to actual tooltips, this commit
introduces a new preference for this extra information: "Reports".

New translation macros are introduced: `RPT_()` and `CTX_RPT_()`, as
well as their equivalent for the Python API, `pgettext_rpt_()`, to be
imported as `rpt_()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/116804
2024-01-12 13:37:29 +01:00
Bastien Montagne
d13edee3e0 UI/Code: Fix typos and other UI messages issues. 2024-01-08 12:03:35 +01:00
Damien Picard
faefaa4447 I18n: extract and disambiguate a few messages
Extract:
- Compositor error messages.
- `bUnitDef`s were broken after cleanup commit 2b77cd726d. Since each
  unit's "display name" is now preceded by a consistent "name_display"
  comment, the regex which extracts the unit is greatly simplified.
  It now relies on the presence of the comment instead of the struct
  order.
- "Preset" menu and "Apply Preset" button from the curveprofile
  template.
- Operator labels from the catalog context menu.

Disambiguate:
- "Bake Data": can mean "Which data to bake" (verb), or "The data that
  were baked" (noun).
- "Cache" in the Simulation Nodes panel is a verb, not a noun.
- "Mix" in the snapping menu is a noun, not a verb.
- "Top" and "Bottom" can mean the upper part of an object or the
  highest point or element of something like a menu or list.

Pull Request: https://projects.blender.org/blender/blender/pulls/115963
2023-12-19 18:41:09 +01:00
Bastien Montagne
5179e1e7d7 I18N: Enable Belarusian language in UI translations. 2023-12-11 12:54:59 +01:00
Bastien Montagne
a0aaee4caf I18N: UI Translatiion: Add Belarusian language entries.
Skipped for now, until we have actual translations available.
2023-11-28 11:17:39 +01:00
Bastien Montagne
7ce745a76b UI messages fixes/cleanups. 2023-11-20 12:20:58 +01:00
Harley Acheson
3f5654b491 Fix #114080: Add Khmer Font
Add Noto Sans Khmer (variable) font, needed for new translation.
2023-11-13 17:38:03 +01:00
Bastien Montagne
e070ff45c4 I18N/UI: Work around #114080: Lack of Khmer script in built-in fonts.
Khmer was added for this release and is barely translated yet (about
1%), so it's not too bad. We will ensure that the Khmer script is added
to our default font for 4.1, but this is too late for 4.0.
2023-10-31 15:13:43 +01:00
Bastien Montagne
ba3e9b3526 I18N: Add (enable) Khmer and Swahili languages. 2023-10-16 11:07:47 +02:00
Damien Picard
2d703e9200 I18n: add label declaration to node sockets so they can be shortened
In !112591, nodes got the ability to group sockets into panels. The
labels for these sockets are automatically shortened if they begin
with the same text as their parent labels. For instance, "Transmission
Weight" will be shortened to just "Weight" because it is under the
"Transmission" panel.

While this is a good heuristic for English, it breaks down in
languages which do not have the same word order.

This commit adds a `.short_label()` callback to socket declarations so
that a shortened label can be explicitly declared.

It also adds two regexps to the translation script so that these new
fields can be extracted to the .po translation files. One extracts the
label with a translation context, the other without. Only the one
without context is currently in use.

The current automatic shortening logic is kept and will be used only
if a shortened label is not manually provided.

Fixes #112970: Node socket labels under panels are not shortened when
translated.

Pull Request: https://projects.blender.org/blender/blender/pulls/113070
2023-10-12 17:51:37 +02:00
Damien Picard
b05db089af I18n: translate node panel titles
Nodes recently gained the ability to group inputs into collapsible
panels. These were untranslated, so this commit:
- Adds the appropriate regex to extract node panels defined with
  the `add_panel()` callback.
- Adds the `IFACE()` translation macro to the drawing code for the
  nodes, as well as the properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/112968
2023-10-03 18:24:19 +02:00
Bastien Montagne
30aaf3b086 I18N: UI Translation: Add Tamil and enable Bulgarian, Greek and Nepali.
These four languages now have some translated strings, so time to show
them in Blender.

NOTE: effect will take place after next week's update in official
Blender builds.
2023-10-03 13:09:26 +02:00
Campbell Barton
7eae806dda Cleanup: format, spelling 2023-09-17 09:05:40 +10:00
Bastien Montagne
e553c71aae I18n Py Module: Update settings after move to Weblate.
This is (mainly) some cleanup in names and descriptions, since we are
not using any SVN repository anymore, and layout of working new Git
repository is quite different.

Change in sync with upcoming update of the `ui_translate` add-on.

Related to https://projects.blender.org/infrastructure/blender-projects-platform/issues/65
2023-09-15 18:08:52 +02:00
Bastien Montagne
0ce02355c1 I18N module: updates for transition to weblate.
Remove `es_ES` language.
Rename `uz_UZ` to `uz_UZ@latin`
Rename `zh_CN` to `zh_HANS`
Rename `zh_TW` to `zh_HANT`

Add support for lowercase chars in `country` part of the locale code
(although in the end it is not needed, since `boost::locale` backend
does not supports lowercase 'country' part in locales identifiers
currently) .

Related to https://projects.blender.org/infrastructure/blender-projects-platform/issues/65
2023-09-15 18:08:52 +02:00
Damien Picard
f64858896c I18n: fix the name of the Czech language
Like other languages, the way the Czech language was called in Czech
was incorrect: "Český is adjective, Čeština is noun".

Ref #105461

Pull Request: https://projects.blender.org/blender/blender/pulls/112130
2023-09-08 14:44:21 +02:00
Campbell Barton
0c26c84704 Cleanup: spelling in comments 2023-09-05 11:04:27 +10:00
Campbell Barton
e8c812a307 Cleanup: spelling in comments, update dictionary 2023-09-03 21:35:07 +10:00
Bastien Montagne
5ba692898e I18N/UI messages fixes. 2023-08-28 18:02:31 +02:00
Campbell Barton
e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Damien Picard
39a94e370c I18n: restore unit messages after c++ migration broke extraction
The units defined in blenkernel/intern/unit.c were extracted using a
regex which contained `NULL`. Commit 129f78eee7 converted this file to
c++, and these `NULL` were replaced with `nullptr`, breaking the
regex.

This commit changes the regex to `nullptr` as well to restore the
translations.

Pull Request: https://projects.blender.org/blender/blender/pulls/110420
2023-07-24 17:01:41 +02:00
Bastien Montagne
739146bf33 UI Translations and messages fixes. 2023-07-10 14:34:41 +02:00
Campbell Barton
65f99397ec License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
Damien Picard
e718f29ec3 I18n: fix node socket extraction regexes
The node socket extraction regexes introduced in 6d39ba7b41 suffered
from two issues:

1. the contextless name extraction would also extract socket names
   which did have a context. To solve, this, use a negative lookahead
   at the end of the regex, containing ".translation_context(".
2. the number of characters in a message was limited to 1, because the
   _str_base component would match one or more chars after the first
   one, while it should have matched zero or more.

This last issues existed before, and the fix allows the extraction of
three new messages.

Pull Request: https://projects.blender.org/blender/blender/pulls/108052
2023-05-22 11:36:59 +02:00
PaulKristoffersson
b7a71d65f8 Fix Estonian language name from #105461
Pull Request: https://projects.blender.org/blender/blender/pulls/108042
2023-05-22 11:13:55 +02:00
Damien Picard
f7ffcd84cc I18n: Add message extraction regexes for node socket labels
Some node sockets get their names from a "label", instead of the
declaration. These labels are not necessarily the same as the
declaration, so they need to be extracted to the translation files.

They are always in a `node_sock_label()` function. It has two args,
the second of which is the string we want to extract.
2023-05-16 14:12:51 +02:00
Damien Picard
6d39ba7b41 I18n: Add message extraction regexes for node socket declarations
The node socket declarations use the `N_()` macro to extract the name
and description of the socket.

This is quite redundant because since the syntax is always the same,
the extraction can be done automatically from the Python translation
module using regexes.

Four new regexes are introduced in bl_i18n_utils.settings:
- one extracts contextless messages from `add_input()` and
  `add_output()`, the basic socket declarations with the names;
- one does the same, but for those sockets which declare a context
  through `.translation_context()`;
- one extracts descriptions and error messages;
- one extracts geometry nodes field inputs.

In addition to making the code simpler and more legible, this change
extracts a few dozen messages which were not tagged with the proper
macro.
2023-05-16 14:12:51 +02:00
Damien Picard
9b64abc236 I18n: Fix some language names from #105461
Some language names were confirmed by native speakers to be
incorrectly spelled (Dutch and Hindi).

Two others were simply capitalized (Vietnamese and Kazakh).

Suspicions remain for other language names, see #105461 for details.

Pull Request: https://projects.blender.org/blender/blender/pulls/107707
2023-05-15 18:06:06 +02:00
Bastien Montagne
dfa42c614f Cleanup: UI messages fixes and tweaks. 2023-04-17 11:41:10 +02:00
Damien Picard
1d43beab84 I18n: Extract asset catalog and asset names and descriptions
The asset catalogs are used in Geometry nodes Add Node menu to
generate the hierarchy of submenus.

The assets themselves are used to generate the operator names in the
same menu, and their descriptions.

This commits enables extraction of this data by parsing the catalog
sidecar file, as well as opening each asset blend file to search for
assets.
2023-03-21 12:41:10 +01:00
Damien Picard
006bc603f8 I18n: translate error messages generated with WM_report() and family
Many error messages were translated when using `BKE_report()` or
`BKE_reportf()`, directly, but others were missing because they used
`WM_report()` or `WM_reportf()`.

This commit adds these two functions to the list of functions used in
the message extraction regex.

In addition, `WM_reportf()` is modified so that the format string is
translated before formatting actually occurs.
2023-03-20 17:17:56 +01:00
Bastien Montagne
3dd071e39b Usual i18n/UI messages fixes. 2023-02-27 16:19:16 +01:00
Bastien Montagne
14368f4d09 Fix/Update to the i18n module settings after git submodule changes. 2023-02-22 10:02:27 +01:00
Sergey Sharybin
03806d0b67 Re-design of submodules used in blender.git
This commit implements described in the #104573.

The goal is to fix the confusion of the submodule hashes change, which are not
ideal for any of the supported git-module configuration (they are either always
visible causing confusion, or silently staged and committed, also causing
confusion).

This commit replaces submodules with a checkout of addons and addons_contrib,
covered by the .gitignore, and locale and developer tools are moved to the
main repository.

This also changes the paths:
- /release/scripts are moved to the /scripts
- /source/tools are moved to the /tools
- /release/datafiles/locale is moved to /locale

This is done to avoid conflicts when using bisect, and also allow buildbot to
automatically "recover" wgen building older or newer branches/patches.

Running `make update` will initialize the local checkout to the changed
repository configuration.

Another aspect of the change is that the make update will support Github style
of remote organization (origin remote pointing to thy fork, upstream remote
pointing to the upstream blender/blender.git).

Pull Request #104755
2023-02-21 16:39:58 +01:00