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

Makes reference to another variable in the same translation file #3

Open
altamiro opened this issue Mar 15, 2015 · 6 comments
Open

Comments

@altamiro
Copy link

Example:

File : lang.en.yml

  • en:
    • hi: "Hello world!!!"
    • common:
      • password: "Password"
      • username: "Username"
      • create: "Create"
      • add: "Add"
      • remove: "Remove"
      • delete: "Clear"
      • cancel: "Cancel"
      • save: "Save"
      • email: "E-mail"
      • search: "Search"
      • login: "Login"
      • register: "Register"
      • version: "Version"
      • logged: "Logged in as reference to common.username "

python-i18n do this? referencing logged to common.username.

@danhper
Copy link
Owner

danhper commented Mar 15, 2015

This functionality is not supported by the current implementation.
I remember having the same issue with other i18n libraries and finally just passed translated strings as variables, for example:

add_translation("foo.with_variable", "%{i18n_variable} is a translation")
add_translation("foo.variable", "my variable")
print(t("foo.with_variable", i18n_variable=t("foo.variable")))

Would this fit your current use case?

@altamiro
Copy link
Author

I had already tested that way there and know it works without problem ..

@danhper
Copy link
Owner

danhper commented Mar 17, 2015

The implementation of nested translations seems to add too much complexity,
but if you want to give it a try I am open for pull requests.

@altamiro
Copy link
Author

I'm new still developing python and it still do not have the knowledge to modify codes. More if you want to make this implementation so that I can test. You can count on me.

@torotil
Copy link

torotil commented Jun 12, 2017

Is there any use case for this? The use-case given above is a perfect example of how translations shouldn’t work. It makes assumptions on the language’s grammar that don’t hold in general.

@Pukimaa
Copy link

Pukimaa commented May 15, 2022

I think actually it would be a little bit more organized and don't require to split to files if it isn't that much

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

No branches or pull requests

4 participants