Skip to content

gettext: refresh page #16555

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

Merged
merged 32 commits into from
May 26, 2025
Merged

gettext: refresh page #16555

merged 32 commits into from
May 26, 2025

Conversation

KristopherLeads
Copy link
Contributor

Updating gettext to include disambiguation options

  • The page(s) are in the correct platform directories: common, linux, osx, windows, sunos, android, etc.
  • The page(s) have at most 8 examples.
  • The page description(s) have links to documentation or a homepage.
  • The page(s) follow the content guidelines.
  • The page(s) follow the style guide.
  • The PR title conforms to the recommended templates.
  • Version of the command being documented (if known): 0.25

Updating gettext to include disambiguation options
@CLAassistant
Copy link

CLAassistant commented May 21, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added page edit Changes to an existing page(s). review needed Prioritized PRs marked for reviews from maintainers. labels May 21, 2025
Updating to correct TLDR005
Updating to reorder help to the last entry and to note the parsing for space-separated format
@KristopherLeads KristopherLeads requested a review from Managor May 21, 2025 17:18
@KristopherLeads KristopherLeads requested a review from Managor May 21, 2025 17:26
Adding more clear explanation of what this is doing
@KristopherLeads KristopherLeads requested a review from Managor May 21, 2025 17:43
@KristopherLeads KristopherLeads requested a review from Managor May 21, 2025 17:54
Including clarity on file structure
@KristopherLeads
Copy link
Contributor Author

KristopherLeads commented May 21, 2025

For anyone reading this thread in the future, this command has a bit of complexity in terms of where it's looking for the localisation content, and people often get hung up on the file structure. If you have a localised file, you must ensure it lives in the following directory structure:

<LOCALEDIR>/<LANG>/LC_MESSAGES/<domain>.mo

This file is made using the msgfmt tool to convert from a .po to an .mo. Note that it's not good enough to just have it in the director - it needs to be in a subdirectory of LC_MESSAGES for gettext to be able to find it. GNU C does this because there's other variables at play, like LC_TIME for date/time formatting and LC_MONETARY for currency. LC_MESSAGES is specifically for software message strings.

If you're running into localisation issues with gettext, make sure you're in the right directory! A common error is to locate the file like this:

<LOCALEDIR>/<LANG>/<domain>.mo

To correct this, just use the move command:

mv <LOCALEDIR>/<LANG>/<domain>.mo <LOCALEDIR>/<LANG>/LC_MESSAGES/<domain>.mo

E.g.:

mv locale/es/asd.mo locale/es/LC_MESSAGES/asd.mo

Removing --context as this is dependent on an update in the core tool, and clarifying that --domain is a requirement. Reworking summary.
@KristopherLeads KristopherLeads requested a review from Managor May 21, 2025 23:43
@KristopherLeads KristopherLeads requested a review from Managor May 23, 2025 16:53
Copy link
Collaborator

@Managor Managor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once you apply these, please voice your opinion on what information is missing from the page. I want you to push back when you think my opinion is wrong.

@Managor Managor changed the title gettext: added disambiguation gettext: refresh page May 23, 2025
@KristopherLeads
Copy link
Contributor Author

KristopherLeads commented May 23, 2025

The only thing I think that's missing here that wouldn't be more confusing to include (thinking --context here) would be:

-n - suppress trailing newline
-V/--version - version of gettext

I'll include in the .md

Copy link
Collaborator

@Managor Managor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like it's complete now. Let me know if there's any information that you feel is missing.

Adding in trailing newline suppression and version check.
@KristopherLeads
Copy link
Contributor Author

This feels like it's complete now. Let me know if there's any information that you feel is missing.

Ok, I think this is complete now!

@KristopherLeads KristopherLeads requested a review from Managor May 23, 2025 19:47
Clarifying the use of the -n flag.
@KristopherLeads KristopherLeads requested a review from Managor May 24, 2025 15:22
@Managor
Copy link
Collaborator

Managor commented May 26, 2025

@KristopherLeads send a new PR when you have the time to expand this page.

@Managor Managor merged commit 3df1bd1 into tldr-pages:main May 26, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
page edit Changes to an existing page(s). review needed Prioritized PRs marked for reviews from maintainers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants